[AYUDA] con mi sistema de tag
#1

queria saber como aumentar los caracteres porque esta configurado para 3 caracteres maximo pero yo quiero 5 caracteres maximo

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define COLOR_RED 0xFF0000AA
#define FILTERSCRIPT

public OnFilterScriptInit()
{
printf("Simple Tag! by RhinoXD!");
printf("~ Succefully Loaded!");
return 1;
}

public OnFilterScriptExit()
{
printf("Simple Tag! by RhinoXD!");
printf("~ Succefully Unloaded!");
return 1;
}

new pname[MAX_PLAYER_NAME], str[MAX_PLAYER_NAME+5]; // Creating the variables.

CMD:mitag(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, "Usted ya tiene un tag use /notag para sacarlo"); // 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: /mitag <tag> [3 caracteres 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
}

este es mi sistema de tag quiero ayuda perdonen y gracias
Reply
#2

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define COLOR_RED 0xFF0000AA
#define FILTERSCRIPT

public OnFilterScriptInit()
{
printf("Simple Tag! by RhinoXD!");
printf("~ Succefully Loaded!");
return 1;
}

public OnFilterScriptExit()
{
printf("Simple Tag! by RhinoXD!");
printf("~ Succefully Unloaded!");
return 1;
}

new pname[MAX_PLAYER_NAME], str[MAX_PLAYER_NAME+5]; // Creating the variables.

CMD:mitag(playerid, params[]) // Creating the command
{
new tag[128]; // 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, "Usted ya tiene un tag use /notag para sacarlo"); // 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: /mitag <tag> [3 caracteres 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
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)