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;
}
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.
if(IsLoggedIn{id} == 0) return SendClientMessage(playerid, RED, "Player not logged in.")
if(IsLoggedIn(id) == 0) return SendClientMessage(playerid, RED, "Player not logged in.");
its nothing about it , he gives errors about SetPlayerName(id, name);
both errors is about that |
new name[56];
if(sscanf(params, "us", id, name)) return SendClientMessage(playerid, RED, "[USAGE]: /changename [name/id] [name]");
why you set player name to integer ? not to string ? change name to:
pawn Код:
pawn Код:
|
new name[24];
Wrong specifier used in sscanf function. Instead of "d", it must be "s[24]". And in name variable, you must create like this:
pawn Код:
@Horrible, if you don't implement the size of the string in latest sscanf, it may occur crash. |
else if(PlayerInfo[playerid][aLevel] >= 2)