Help Please
#1

The script works, but when I do it, it sets whoever's id is 0.

PHP код:
command(givebadgeplayeridparams[])
{
    new 
idbadgestring[255];
    if(
sscanf(params"zz"idbadge))
    {
        if((
Player[playerid][Group] == || Player[playerid][Group] == 4) && Player[playerid][GroupRank] >= 7)
        {
            
SendClientMessage(playeridWHITE"SYNTAX: /givebadge [playerid] [badge]");
        }
    }
    else
    {
        if((
Player[playerid][Group] == || Player[playerid][Group] == 4) && Player[playerid][GroupRank] >= 7)
        {
            
Player[id][BadgeNumber] = badge;
            
format(stringsizeof(string), "You have given %s the badge number %s"GetName(id), badge);
            
SendClientMessage(playeridWHITEstring);
            
format(stringsizeof(string), "%s has changed your badge number to %s"GetName(playerid), badge);
            
SendClientMessage(idWHITEstring);
        }
    }

Reply
#2

pawn Код:
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]");
}
try this...
Reply
#3

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
pawn Код:
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]");
}
try this...
It still happens. That didnt fix it
Reply
#4

are you trying it on yourself / or a disconnected player?
Reply
#5

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 Код:
new badge[128];
if(!sscanf(params, "us[128]", id, badge))
As you can see, you also need to specify the string's size.
Reply
#6

Quote:
Originally Posted by admantis
Посмотреть сообщение
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 Код:
new badge[128];
if(!sscanf(params, "us[128]", id, badge))
As you can see, you also need to specify the string's size.
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
Reply
#7

Quote:
Originally Posted by Nuke547
Посмотреть сообщение
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!
Reply
#8

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
If its gonna be a number(integer) Then use i instead of us which is for a string!
Can you reply with what it is supposed to be? Its not working
Reply
#9

Bump
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)