Posts: 126
Threads: 24
Joined: Mar 2012
Hello everyone ,
I'm here to ask something which I'm facing all the time.. I'm sure you don't need any code for it.
So my admin system is just bugged, I don't know why, I logged in Rcon, /makeadmin but it shows " Invalid ID "
but I did it manually through scriptfiles then I went ingame and tested /slap, It gave " Player not Connected " or " Invalid ID ".. All of the cmds are giving " invalid id " and " player not connected " Errors.. anyone got idea why ?
update sscanf plugin and include
Posts: 126
Threads: 24
Joined: Mar 2012
Everycode .. I'll give you /makeadmin and slap most of the codes are like it.
pawn Код:
//-----[Make admin]-----
COMMAND:makeadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
new id, lvl;
if(sscanf(params, "ui", id, lvl)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /makeadmin [PlayerID/PartOfName] [Level]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Invalid ID");
else if(lvl > 5) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Administrator level cannot be higher then 5!");
else
{
PlayerInfo[id][Adminlevel] = lvl;
}
return 1;
}
//-----[Slap]-----
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /slap [PlayerID/PartOfName]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!");
else
{
new Float:SLX, Float:SLY, Float:SLZ;
GetPlayerPos(targetid, SLX, SLY, SLZ);
SetPlayerPos(targetid, SLX, SLY, SLZ+5);
PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5);
new string[128];
new pName[24], pTame[24];
GetPlayerName(playerid,pName,24);
GetPlayerName(targetid,pTame,24);
format(string,sizeof string,""#COL_YELLOW"[SERVER]"#COL_LRED" %s has been slapped by Administrator %s.",pTame,pName);
SendClientMessageToAll(COLOR_RED, string);
}
return 1;
}