Advertisement
elrooT

Simple Tag! 0.1 ~

Sep 24th, 2011
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.67 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. #define COLOR_RED           0xFF0000AA
  6. #define FILTERSCRIPT
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.     printf("Simple Tag! by rooT. / leaNN!");
  11.     printf("~ Succefully Loaded!");
  12.     return 1;
  13. }
  14.  
  15. public OnFilterScriptExit()
  16. {
  17.     printf("Simple Tag! by rooT. / leaNN!");
  18.     printf("~ Succefully Unloaded!");
  19.     return 1;
  20. }
  21.  
  22. new pname[MAX_PLAYER_NAME], str[MAX_PLAYER_NAME+5]; // Creating the variables.
  23.  
  24. CMD:mytag(playerid, params[]) // Creating the command
  25. {
  26.     new tag[5]; // We define "tag" with a value of 5 cells.
  27.     if(!sscanf(params, "s[4]", tag)) // sscanf, it format "tag" with the first 3 characters of "params"
  28.     {
  29.         if(!strfind(tag, "[") || !strfind(tag, "]")) return SendClientMessage(playerid, COLOR_RED, "You shouldn't include '[' and ']' !"); // Si se encuentra [ o ], return 0.
  30.         if(GetPVarInt(playerid, "Tag") == 0) // If the player hasn't a tag.
  31.         {
  32.             GetPlayerName(playerid, pname, sizeof(pname)); // We get the player name and save it in pname.
  33.             SetPVarString(playerid, "OldName", pname); // We save the player name in the variable "OldName"
  34.             format(str, sizeof(str), "[%s]%s", tag, pname); // We format str with the tag and the name of the player.
  35.             SetPlayerName(playerid, str); // We change the player's name
  36.             SetPVarInt(playerid, "Tag", 1); // We indicate that the player now has a tag.
  37.         }
  38.         else
  39.         {
  40.             GetPVarString(playerid, "OldName", pname, 24); //We get the OldName string.
  41.             SetPlayerName(playerid, pname); // We change the player name to the original name.
  42.            
  43.             GetPlayerName(playerid, pname, sizeof(pname)); // We get the player name and save it in pname.
  44.             SetPVarString(playerid, "OldName", pname); // We save the player name in the variable "OldName"
  45.             format(str, sizeof(str), "[%s]%s", tag, pname); // We format str with the tag and the name of the player.
  46.             SetPlayerName(playerid, str); // We change the player's name
  47.             SetPVarInt(playerid, "Tag", 1); // We indicate that the player now has a tag.
  48.         }
  49.     } else return SendClientMessage(playerid, COLOR_RED, "Uso: /mytag <tag> [3 Characters max!]"); // sscanf, si "tag" es mayor a 3 o es nulo.
  50.     return 1; // End of the Command
  51. }
  52.  
  53. CMD:notag(playerid, params[]) // Creating the command
  54. {
  55.     if(GetPVarInt(playerid, "Tag") == 0) return SendClientMessage(playerid, COLOR_RED, "Tu no tienes un tag!"); // Si el jugador no tiene un tag, return 0.
  56.     GetPVarString(playerid, "OldName", pname, 24); //We get the OldName string.
  57.     SetPlayerName(playerid, pname); // We change the player name to the original name.
  58.     SetPVarInt(playerid, "Tag", 0); // We indicate that the player now hasn't a tag.
  59.     return 1; // End of the Command
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement