Skip to content

Instantly share code, notes, and snippets.

YSI_Core/y_core/y_samp_natives.inc | 7 ++++++
YSI_Core/y_testing/y_testing_entry.inc | 16 ++++----------
YSI_Visual/y_dialog/y_dialog_impl.inc | 40 ++++++++++++++++++++++------------
3 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/YSI_Core/y_core/y_samp_natives.inc b/YSI_Core/y_core/y_samp_natives.inc
index f871a819..eb0da12a 100644
--- a/YSI_Core/y_core/y_samp_natives.inc
+++ b/YSI_Core/y_core/y_samp_natives.inc
@@ -80,3 +80,10 @@ native YSI_PrintF(const format[], GLOBAL_TAG_TYPES:...) = printf;
@Y-Less
Y-Less / fix.md
Created December 14, 2020 03:58

Natives

A native function is one in the server itself, either from SA:MP or a plugin. IsPlayerConnected is a SA:MP native, sscanf is a plugin native. Similarly, ShowPlayerDialog is a SA:MP native; calling it from your script will invoke some behaviour in the server. A native is normally declared as:

native IsPlayerConnected(playerid);
native ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);

You can also set an internal and external name for a native:

YSI_Core/y_core/y_samp_natives.inc | 2 ++
YSI_Core/y_testing/y_testing_entry.inc | 2 --
YSI_Visual/y_dialog/y_dialog_impl.inc | 14 ++++----------
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/YSI_Core/y_core/y_samp_natives.inc b/YSI_Core/y_core/y_samp_natives.inc
index f871a819..b74ad0e6 100644
--- a/YSI_Core/y_core/y_samp_natives.inc
+++ b/YSI_Core/y_core/y_samp_natives.inc
@@ -80,3 +80,5 @@ native YSI_PrintF(const format[], GLOBAL_TAG_TYPES:...) = printf;
@Y-Less
Y-Less / Maths.cs
Created July 31, 2020 13:27
Truncated.
using System;
namespace Y_Less
{
public class DivideByNoughtException : ArithmeticException
{
/// <summary>
/// Initializes a new instance of the Y_Less.DivideByNoughtException class.
/// </summary>
public DivideByNoughtException()
This file has been truncated, but you can view the full file.
using System;
namespace Y_Less
{
public class DivideByNoughtException : ArithmeticException
{
/// <summary>
/// Initializes a new instance of the Y_Less.DivideByNoughtException class.
/// </summary>
public DivideByNoughtException()
#include "curry.hpp"
#include <iostream>
int AddThree(int a, int b, int c)
{
return a + b + c;
}
int main()
{
@Y-Less
Y-Less / curry.hpp
Created November 13, 2019 11:25
Curry functions. Can be improved with better move semantics.
#include <tuple>
#include <functional>
template <typename RET, typename FUNC, int N, typename... ARGS>
struct CurriedCaller
{
template <typename... TUPLED>
static RET Call(FUNC & f, std::tuple<TUPLED...> const & t, ARGS ...args)
{
return CurriedCaller<RET, FUNC, N - 1, decltype (std::get<N - 1>(t)), ARGS...>::Call(f, t, std::get<N - 1>(t), args...);
#define INVALID_DIALOG_ID (cellmin)
static stock
gPrev[MAX_PLAYERS] = { INVALID_DIALOG_ID, ... },
gCur[MAX_PLAYERS] = { INVALID_DIALOG_ID, ... },
bool:gOPDR = true;
hook function ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
{
gCur[playerid] = dialogid;
#define INVALID_DIALOG_ID (cellmin)
static stock
gPrev[MAX_PLAYERS] = { INVALID_DIALOG_ID, ... },
gCur[MAX_PLAYERS] = { INVALID_DIALOG_ID, ... };
stock Prev_ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
{
gCur[playerid] = dialogid;
return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
#if defined _INC_if_extract
#endinput
#endif
#define _INC_if_extract
/*
88888888888 88
88 88
88 88