Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define COLOR_RED 0xFF0000AA
- #define FILTERSCRIPT
- public OnFilterScriptInit()
- {
- printf("Simple Tag! by rooT. / leaNN!");
- printf("~ Succefully Loaded!");
- return 1;
- }
- public OnFilterScriptExit()
- {
- printf("Simple Tag! by rooT. / leaNN!");
- printf("~ Succefully Unloaded!");
- return 1;
- }
- new pname[MAX_PLAYER_NAME], str[MAX_PLAYER_NAME+5]; // Creating the variables.
- CMD:mytag(playerid, params[]) // Creating the command
- {
- new tag[5]; // We define "tag" with a value of 5 cells.
- if(!sscanf(params, "s[4]", tag)) // sscanf, it format "tag" with the first 3 characters of "params"
- {
- if(!strfind(tag, "[") || !strfind(tag, "]")) return SendClientMessage(playerid, COLOR_RED, "You shouldn't include '[' and ']' !"); // Si se encuentra [ o ], return 0.
- if(GetPVarInt(playerid, "Tag") == 0) // If the player hasn't a tag.
- {
- GetPlayerName(playerid, pname, sizeof(pname)); // We get the player name and save it in pname.
- SetPVarString(playerid, "OldName", pname); // We save the player name in the variable "OldName"
- format(str, sizeof(str), "[%s]%s", tag, pname); // We format str with the tag and the name of the player.
- SetPlayerName(playerid, str); // We change the player's name
- SetPVarInt(playerid, "Tag", 1); // We indicate that the player now has a tag.
- }
- else
- {
- GetPVarString(playerid, "OldName", pname, 24); //We get the OldName string.
- SetPlayerName(playerid, pname); // We change the player name to the original name.
- GetPlayerName(playerid, pname, sizeof(pname)); // We get the player name and save it in pname.
- SetPVarString(playerid, "OldName", pname); // We save the player name in the variable "OldName"
- format(str, sizeof(str), "[%s]%s", tag, pname); // We format str with the tag and the name of the player.
- SetPlayerName(playerid, str); // We change the player's name
- SetPVarInt(playerid, "Tag", 1); // We indicate that the player now has a tag.
- }
- } else return SendClientMessage(playerid, COLOR_RED, "Uso: /mytag <tag> [3 Characters max!]"); // sscanf, si "tag" es mayor a 3 o es nulo.
- return 1; // End of the Command
- }
- CMD:notag(playerid, params[]) // Creating the command
- {
- if(GetPVarInt(playerid, "Tag") == 0) return SendClientMessage(playerid, COLOR_RED, "Tu no tienes un tag!"); // Si el jugador no tiene un tag, return 0.
- GetPVarString(playerid, "OldName", pname, 24); //We get the OldName string.
- SetPlayerName(playerid, pname); // We change the player name to the original name.
- SetPVarInt(playerid, "Tag", 0); // We indicate that the player now hasn't a tag.
- return 1; // End of the Command
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement