zcmd setadmin command brokeee. D:
#1

pawn Code:
CMD:setadmin(playerid, params[])
{
new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
if(GetPVarInt(playerid, "Level") == 1)
{
if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin [id] [adminlevel]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
if (admlvl > 3 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"Invalid level");
SetPVarInt(id, "Level") = admlvl;// this line here is the fuckup
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, adminname, sizeof(adminname));
new stri[128];
format(stri,128,"AdmWarn: %s [ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
SendClientMessageToAll(COLOR_GREEN,str);
return 1;
}else return SendClientMessage(playerid,COLOR_RED,"  You arent the level!");}
Ok so, trying to set the level to a PVar but its confusing, any idea how?
Reply
#2

SetPVarInt(playerid, varname[], int_value)
Pvar's are like this SetPVarInt(playerid, "Money", GetPlayerMoney(playerid)) //from the wiki
So in your case it would be like
SetPVarInt(id, "Level",admlvl);
Reply
#3

pawn Code:
SetPVarInt(id, "Level", admlvl);
Code:
playerid, varname, value
Reply
#4

Why Pvars and not normal vars?
Reply
#5

Pvars are more sufficient for saving imo. And thanks guys, works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)