CMD:goto(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new plo;
if(!sscanf(params, "u", plo))
{
if (IsPlayerConnected(plo))
{
new Float:plocx,Float:plocy,Float:plocz;
new world = GetPlayerVirtualWorld(plo);
new intid = GetPlayerInterior(plo);
GetPlayerPos(plo, plocx, plocy, plocz);
SetPlayerInterior(playerid, intid);
SetPlayerVirtualWorld(playerid, world);
if (GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid), plocx, plocy+4, plocz);
}
else
{
SetPlayerPos(playerid,plocx,plocy+2, plocz);
}
return 1;
}
else
{
SendClientMessage(playerid, -1, "Invalid player");
}
}
else
{
SendClientMessage(playerid, -1, "USAGE: /Goto [playerid/PartOfName]");
return 1;
}
}
return 1;
}
CMD:makeadmin(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 9999)
{
new para1,level;
if(!sscanf(params, "ui", para1, level))
{
if(level > 9999 || level < 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Invalid admin level!");
return 1;
}
if(IsPlayerConnected(para1))
{
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new string[128];
sendername = PlayerNameEx(playerid);
giveplayer = PlayerNameEx(para1);
if(level == 0)
{
PlayerInfo[para1][pAdmin] = 0;
PlayerInfo[para1][pNewbRank] = 0;
format(string, sizeof(string),"AdmCmd: %s has removed %s's Admin status.", sendername, giveplayer);
print(string);
ABroadCast(COLOR_YELLOW2, string, 1);
format(string, sizeof(string), " Your Admin status has been removed by %s.", sendername);
SendClientMessage(para1, COLOR_LIGHTRED, string);
return 1;
}
if(level < PlayerInfo[para1][pAdmin])
{
PlayerInfo[para1][pNewbRank] = 2;
format(string, sizeof(string),"AdmCmd: %s has demoted %s to a level %d admin.", sendername, giveplayer, level);
ABroadCast(COLOR_YELLOW2, string, 1);
format(string, sizeof(string), " You have been demoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTRED, string);
format(string, sizeof(string), " You have demoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
}
else
{
PlayerInfo[para1][pNewbRank] = 2;
format(string, sizeof(string),"AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
ABroadCast(COLOR_YELLOW2, string, 1);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
}
PlayerInfo[para1][pAdmin] = level;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /MakeAdmin [playerid/PartOfName] [Admin Level]");
}
}
return 1;
}
If your sscanf is outdated, update it.
I remember having same bug back when sscanf wasn't updated it would make everything related to player go to ID 0. |