help please
#1

pawn Код:
CMD:changename(playerid, params[])
{
    new name, id;
    if(sscanf(params, "ud", id, name)) return SendClientMessage(playerid, RED, "[USAGE]: /changename [name/id] [name]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "Player not found.");
    if(IsLoggedIn{id} == 0) return SendClientMessage(playerid, RED, "Player not logged in.");
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerName(id, name);
        PlayerPlaySound(id,1085,0.0,0.0,0.0);
        format(fstr, sizeof(fstr), "You have set %s [%d] name to %d.", GetName(id), id, name);
        SendClientMessage(playerid, YELLOW, fstr);
        format(fstr, sizeof(fstr), "Admin %s [%d] has set your name to %d.", GetName(playerid), playerid, name);
        SendClientMessage(id, LIGHTGREEN, fstr);
        SaveUserStats(id);
    }
    else if(PlayerInfo[playerid][aLevel] == 2)
    {
        SetPlayerName(id, name);
        PlayerPlaySound(id,1085,0.0,0.0,0.0);
        format(fstr, sizeof(fstr), "You have set %s [%d] name to %d.", GetName(id), id, name);
        SendClientMessage(playerid, YELLOW, fstr);
        format(fstr, sizeof(fstr), "Admin %s [%d] has set your name to %d.", GetName(playerid), playerid, name);
        SendClientMessage(id, LIGHTGREEN, fstr);
        SaveUserStats(id);
    }
    else
    {
        SendClientMessage(playerid, RED, "Only admin level 2 can use this command.");
    }
    return true;
}

ERRORS:
Код:
C:\Users\eesti\Desktop\server\gamemodes\NVCNR.pwn(23400) : error 035: argument type mismatch (argument 2)
C:\Users\eesti\Desktop\server\gamemodes\NVCNR.pwn(23410) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
eny help?
Reply
#2

pawn Код:
if(IsLoggedIn{id} == 0) return SendClientMessage(playerid, RED, "Player not logged in.")
Wrong brackets used in IsLoggedIn fucntion. Correct:
pawn Код:
if(IsLoggedIn(id) == 0) return SendClientMessage(playerid, RED, "Player not logged in.");
Reply
#3

its nothing about it , he gives errors about SetPlayerName(id, name);
both errors is about that
Reply
#4

Quote:
Originally Posted by James Coral
Посмотреть сообщение
its nothing about it , he gives errors about SetPlayerName(id, name);
both errors is about that
why you set player name to integer ? not to string ? change name to:
pawn Код:
new name[56];
then change this too :
pawn Код:
if(sscanf(params, "us", id, name)) return SendClientMessage(playerid, RED, "[USAGE]: /changename [name/id] [name]");
Reply
#5

Quote:
Originally Posted by Horrible
Посмотреть сообщение
why you set player name to integer ? not to string ? change name to:
pawn Код:
new name[56];
then change this too :
pawn Код:
if(sscanf(params, "us", id, name)) return SendClientMessage(playerid, RED, "[USAGE]: /changename [name/id] [name]");
thanks +rep
Reply
#6

Wrong specifier used in sscanf function. Instead of "d", it must be "s[24]". And in name variable, you must create like this:
pawn Код:
new name[24];
Edit:late,
@Horrible, if you don't implement the size of the string in latest sscanf, it may occur crash.
Reply
#7

the highest admin level is 4 (i am) but command is for level 2 and it says that i need to be level 2
Reply
#8

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Wrong specifier used in sscanf function. Instead of "d", it must be "s[24]". And in name variable, you must create like this:
pawn Код:
new name[24];
Edit:late,
@Horrible, if you don't implement the size of the string in latest sscanf, it may occur crash.
what you mean s[24]? and d?
Reply
#9

pawn Код:
else if(PlayerInfo[playerid][aLevel] >= 2)
Reply
#10

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
pawn Код:
else if(PlayerInfo[playerid][aLevel] >= 2)
where i put this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)