command(givebadge, playerid, params[])
{
new id, badge, string[255];
if(sscanf(params, "zz", id, badge))
{
if((Player[playerid][Group] == 1 || Player[playerid][Group] == 4) && Player[playerid][GroupRank] >= 7)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /givebadge [playerid] [badge]");
}
}
else
{
if((Player[playerid][Group] == 1 || Player[playerid][Group] == 4) && Player[playerid][GroupRank] >= 7)
{
Player[id][BadgeNumber] = badge;
format(string, sizeof(string), "You have given %s the badge number %s", GetName(id), badge);
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "%s has changed your badge number to %s", GetName(playerid), badge);
SendClientMessage(id, WHITE, string);
}
}
}
command(givebadge, playerid, params[])
{
new id, badge, string[255];
if(!sscanf(params, "ds", id, badge))
{
if((Player[playerid][Group] == 1 || Player[playerid][Group] == 4) && Player[playerid][GroupRank] >= 7)
{
Player[id][BadgeNumber] = badge;
format(string, sizeof(string), "You have given %s the badge number %s", GetName(id), badge);
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "%s has changed your badge number to %s", GetName(playerid), badge);
SendClientMessage(id, WHITE, string);
}
}
else return SendClientMessage(playerid, WHITE, "SYNTAX: /givebadge [playerid] [badge]");
}
pawn Код:
|
new badge[128];
if(!sscanf(params, "us[128]", id, badge))
That is because the sscanf specieirs are not used correctly.
Use "u" for players. And in format, are you using a string specifier for a integer? Is "badge" a string or a value? If it's a string do like this pawn Код:
|
Im not sure. Its more of a string, but its basically gonna be like Your name Badge Number:
Could you please put it like i should put it in the script |
If its gonna be a number(integer) Then use i instead of us which is for a string!
|