Bibliothèque★ 1mis à jour avr. 2020Pas de licencePawn
Ouvrir sur GitHubCe dépôt n’a pas de fichier de licence. Il est public en lecture, mais cela ne donne pas à lui seul le droit de le réutiliser.
L’essayer dans le compilateur Pawn →
Ajoute ses fichiers include, avec les bibliothèques dont il dépend, au compilateur Pawn de ton navigateur, prêts à être inclus dans un script.
README.md
SA-MP-Useful-Macros (v1.0)
CONNECTED
// Example 1:
forward MyFunc(playerid);
public MyFunc(playerid)
{
CONNECTED playerid
{
// ... Something will happend if playerid is connected
}
return 1;
}
// Example 2:
forward MyFunc(playerid);
public MyFunc(playerid)
{
CONNECTED !playerid
{
// ... If playerid isn't connected
}
return 1;
}
randomEx
main()
{
printf("%d", randomEx(2, 6));
// Output: Random number between 2 and 6.
}
error & debug
#undef MAX_PLAYERS
#define MAX_PLAYERS 32
main()
{
#if MAX_PLAYERS > 32
// Example 1:
error The number of max players must be 32! // Output: Error: The number of MAX_PLAYERS must be 32!
// Example 2:
error The number of max players must be %d!, MAX_PLAYERS // Output: Error: The number of MAX_PLAYERS must be 32!
// Example 3:
error "The number of max players must be %d!", MAX_PLAYERS // Output: Error: The number of MAX_PLAYERS must be 32!
#endif
}
CreateLabel
// Without streamer
public OnGameModeInit()
{
CreateLabel("text", 0xFFFFFFAA, 0.0, 0.0, 0.0, <30.0>);
return 1;
}
// With streamer
public OnGameModeInit()
{
CreateLabel("text", 0xFFFFFFAA, 0.0, 0.0, 0.0, <30.0>, <30.0>);
return 1;
}
Player Loop
public OnPlayerConnect(playerid)
{
PlayerLoop::<i>
{
// code...
}
return 1;
}
Loop
main()
{
Loop::i<20>
{
print("This message will be printed 20 times.");
}
}
FUNCTION
main()
{
Test(20);
}
FUNCTION::Test<int>
{
return printf("%d", int);
}
Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche