zcmd setadmin command brokeee. D: - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: zcmd setadmin command brokeee. D: (
/showthread.php?tid=241482)
zcmd setadmin command brokeee. D: -
-Rebel Son- - 18.03.2011
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?
Re: zcmd setadmin command brokeee. D: -
Haydz - 18.03.2011
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);
Re: zcmd setadmin command brokeee. D: - [L3th4l] - 18.03.2011
pawn Code:
SetPVarInt(id, "Level", admlvl);
Code:
playerid, varname, value
Re: zcmd setadmin command brokeee. D: -
Tee - 18.03.2011
Why Pvars and not normal vars?
Re: zcmd setadmin command brokeee. D: -
-Rebel Son- - 18.03.2011
Pvars are more sufficient for saving imo. And thanks guys, works