30.09.2011, 23:56
I was wondering how I can change some ones variables from ingame, like their admin level, vip level, etc and I STILL need help with checkpoints if anyone can point me to a good tutorial or explain it, thanks!
COMMAND:makeadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
new id, lvl;
if(sscanf(params, "ui", id, lvl)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Level]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
else if(lvl > 1) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ADMIN]"#COL_LRED" Administrator level cannot be higher then 1!");
else
{
PlayerInfo[id][Adminlevel] = lvl;
}
return 1;
}
CMD:makeadmin(playerid, params[]){
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_GRAY,"ERROR: You're not authorized to use this command!");
new id, lvl;
if(sscanf(params, "ui", id, lvl)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /makeadmin [PlayerID/PartOfName] [Level]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
else
{
PlayerInfo[playerid][pAdmin] = lvl;
}
return 1;
}
CMD:makeadmin(playerid, params[]){
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_GRAY,"ERROR: You're not authorized to use this command!");
new id, lvl;
if(sscanf(params, "ui", id, lvl)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /makeadmin [PlayerID/PartOfName] [Level]");
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
else
{
PlayerInfo[playerid][pAdmin] = lvl;
}
return 1;
}
CMD:kick(playerid,params[]){
new id,reason[128];
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_GRAY,"ERROR: You're not authorized to use this command!");
else if(sscanf(params, "uz",id,reason)) return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /kick [ID] [REASON]");
else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick yourself!");
else if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_GRAY,"You can not kick an admin!");
else if(id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_GRAY,"Error: Player not connected!");
else{
new name,string[128];
format(string,sizeof(string),"%s has just kicked %s, Reason: %s",GetName(playerid),name);
SendClientMessageToAll(COLOR_RED,string);
Kick(playerid);
}
return 1;
}
CMD:setadminlevel(playerid, params[])
{
new oID, oLvl;
if (sscanf(params, "ui", oID, oLvl)) { return SendClientMessage(playerid, COLOR_WHITE, "... How to use it."); }
if (PlayerInfo[playerid][pAdmin] > 0)
{
if (oID != INVALID_PLAYER_ID)
{
if (PlayerInfo[playerid][pAdmin] > oLvl) { PlayerInfo[oID][pAdmin] = oLvl; }
else { return SendClientMessage(playerid, COLOR_WHITE, "... Can't set player as high or higher than you.");
}
else { return SendClientMessage(playerid, COLOR_WHITE, "... ID not connected/valid."); }
}
else { return SendClientMessage(playerid, COLOR_WHITE, "... Not an admin."); }
// Here you can spit out all the, admin has done blah blah, you have successfully blah blah.
// You can do it here, because if not successful, any 1 of the else cases will exit early.
return 1;
}