[CMD] /Setadmin just works on ID 0 [Rep+] -
Spooky - 29.12.2011
pawn Код:
CMD:setadmin(playerid, params[])
{
new id, level, string[128];
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 3)
{
if(!sscanf(params,"ui", id, level))
{
if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID)
{
if(level >= 0 && level <= 5)
{
if(PlayerInfo[playerid][pAdmin] > PlayerInfo[id][pAdmin])
{
if(level != PlayerInfo[id][pAdmin])
{
format(string, sizeof(string),"Admin %s have set your admin rank to level %d.", GetName(playerid), level);
SendClientMessage(id, COLOR_RED, string);
format(string ,sizeof(string),"[Name: %s | Old Rank: %d | New Rank: %d]", GetName(id), PlayerInfo[id][pAdmin], level);
SendClientMessage(playerid, COLOR_RED, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Rank "GREEN"Succesfully "LIGHTBLUE"updated(Changed).");
PlayerInfo[id][pAdmin] = level;
}
else SendClientMessage(playerid, ERROR,"The player is already that level administrator.");
}
else SendClientMessage(playerid, ERROR,"You cannot promote/demote a higher level admin than you.");
}
else SendClientMessage(playerid, ERROR,"Levels are only from 0 - 5");
}
else SendClientMessage(playerid, ERROR,"Invalid Player.");
}
else SendClientMessage(playerid, ERROR,"Usage: /setadmin [playerid] [level]");
}
else SendClientMessage(playerid, ERROR,"You are not authorized to use that command.");
return 1;
}
This is the Code and it only works on the ID 0
And i want to add this thing in this that if a player increases the level then it should say Promoted and if level < and then it says Demoted.
Re: [CMD] /Setadmin just works on ID 0 [Rep+] -
§с†¶e®РµРe - 29.12.2011
https://sampforum.blast.hk/showthread.php?tid=298218
Re: [CMD] /Setadmin just works on ID 0 [Rep+] -
Spooky - 29.12.2011
Please check this is my code and nicely indented but still that problem that it just works on ID 0
pawn Код:
CMD:rsetadmin(playerid, params[])
{
new id, level, string[128];
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params,"ui", id, level))
{
if(level < 6 && level >= 0)
{
if(IsPlayerConnected(id))
{
if(PlayerInfo[id][pAdmin] != level)
{
if(PlayerInfo[id][pAdmin] < level)
{
PlayerInfo[id][pAdmin] = level;
format(string, sizeof(string),"RCON Admin %s have promoted you to admin level %i.",GetName(playerid), level);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string),"You have promoted %s to admin level %i.", GetName(id), level);
SendClientMessage(playerid, COLOR_RED, string);
}
else
{
PlayerInfo[id][pAdmin] = level;
format(string, sizeof(string),"RCON Admin %s have demoted you to admin level %i.",GetName(playerid), level);
SendClientMessage(id, COLOR_RED, string);
format(string, sizeof(string),"You have demoted %s to admin level %i.",GetName(id), level);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else SendClientMessage(playerid, ERROR,"The player is already that level admin.");
}
else SendClientMessage(playerid, ERROR,"Invalid Player.");
}
else SendClientMessage(playerid, ERROR,"Levels only from 0 - 5.");
}
else SendClientMessage(playerid, ERROR,"Usage: /rsetadmin [playerid] [Level]");
}
else SendClientMessage(playerid, ERROR,"You are not authorized to use that command.");
return 1;
}
Re: [CMD] /Setadmin just works on ID 0 [Rep+] -
robintjeh - 29.12.2011
https://sampforum.blast.hk/showthread.php?tid=120356
Re: [CMD] /Setadmin just works on ID 0 [Rep+] -
Spooky - 29.12.2011
Dude whats the problem in sscanf, i am having sscanf with 0.3d R2
Re: [CMD] /Setadmin just works on ID 0 [Rep+] -
iChronic - 29.12.2011
SpoOky.....
oOOOoOOoOOoooOOOOoooOOOOooOOOOOooOOOOoo So Use WIKI for that or Copy it from any other Admin script...
Re: [CMD] /Setadmin just works on ID 0 [Rep+] -
Spooky - 29.12.2011
I Got the Problem. Its Sscanf version.
I was having sscanf for 0.3d not 0.3dR2 now i downloaded and installed it
Its working fine now.