29.03.2017, 10:38
Quote:
Isn't that what I have?
Код:
new adminLevel; new PID; new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME]; GetPlayerName(PID, name, sizeof(name)); if(sscanf(params, "ud", PID, adminLevel)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin [playerid] [admin-level]"); if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected"); PlayerInfo[PID][pAdmin] = adminLevel; format(string, sizeof(string), "[ADMIN]: You have set %s's admin level to %d.", name, adminLevel); SendClientMessage(playerid, COLOR_SERVER, string); |
You need to put
PHP код:
GetPlayerName(PID, name, sizeof(name));
PHP код:
if(sscanf(params, "ud", PID, adminLevel)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin [playerid] [admin-level]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected");
So your code need to look like this:
PHP код:
new adminLevel;
new PID;
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
if(sscanf(params, "ud", PID, adminLevel)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin [playerid] [admin-level]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected");
GetPlayerName(PID, name, sizeof(name));//Here PID is specified and is valid (it's get the value that you enter for [playerid])
PlayerInfo[PID][pAdmin] = adminLevel;
format(string, sizeof(string), "[ADMIN]: You have set %s's admin level to %d.", name, adminLevel);
SendClientMessage(playerid, COLOR_SERVER, string);
Or try a code above,they are all corect