/makeadmin CMD problems - 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: /makeadmin CMD problems (
/showthread.php?tid=96419)
/makeadmin CMD problems -
MisterTickle - 08.09.2009
Код:
dcmd_makeadmin(playerid, params[])
{
new
str[128];
if(IsPlayerConnected(playerid))
{
if(PlayerI[playerid][PlayerAdmin] == 0) return SystemMsg (playerid, "You must be a admin to use this command!");
new giveplayerid = ReturnUser(params);
if(sscanf(params, "us", giveplayerid, PlayerAdmin)) return SystemMsg(playerid, " Usage : /makeadmin [playerid / name] [admin level]");
if(!IsPlayerConnected(giveplayerid)) return SystemMsg(playerid, "That player is not connected!");
else
{
format(str, sizeof(str), "ADMIN %s has made %s level %s admin", PlayerName(playerid), PlayerName(giveplayerid), PlayerAdmin);
SendClientMessageToAll(COLOR_YELLOW, str); PlayerI[giveplayerid][PlayerAdmin];
}
}
return 1;
I am trying to make it so an admin an set a player admin level and it saves to player and than saves to the user file on /q on disconnect (Which it already does, I managed to make it just set you to level 1 but i need it to set you to any value picked)
Re: /makeadmin CMD problems -
x-cutter - 08.09.2009
I don't get your problem...
Re: /makeadmin CMD problems -
_Vortex - 08.09.2009
Ahh, I had the same problem
This fixed it:
pawn Код:
public OnPlayerDisconnect(playerid,reason)
{
dini_IntSet(PlayerFile, "Level", pInfo[playerid][Level]);
return 1;
}
(modify the settings to what you have)
Re: /makeadmin CMD problems -
iLinx - 08.09.2009
heres your problem.
1: you've got PlayerAdmin defined as a string in sscanf (replace the s with a i)
2. In your else statment your doing this
PlayerI[giveplayerid][PlayerAdmin];
you need to do this
PlayerI[giveplayerid][PlayerAdmin] = PlayerAdmin(or whatever variable you have defined for the level number);
i would say change PlayerAdmin to another variable like newlevel or something, it makes it easier to understand.