13.11.2010, 22:38
Hi, this is kinda like a repost.. (not exacly the same)
I have a problem in my server, that when all people have "admin" rights (for /menu -teleports)
I just can't make my /jail command set the admin level to 0, and when they are un-jailed their admin level is set to 10.
Please help, I have been thinking for ages.
/jail and /unjail
This is the cmd to make someone an admin
I am thankful for all help.
I have a problem in my server, that when all people have "admin" rights (for /menu -teleports)
I just can't make my /jail command set the admin level to 0, and when they are un-jailed their admin level is set to 10.
Please help, I have been thinking for ages.
/jail and /unjail
pawn Код:
//-------------------------------[JAIL]-----------------------------------------
if(strcmp(cmd, "/jail", true) == 0)
{
new tmp2[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid] [time]");
tmp2 = strtok(cmdtext, idx);
new money = strval(tmp2);
if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /jail [playerid] [time]");
new playa;
playa = ReturnUser(tmp);
if(PlayerInfo[playerid][pAdmin] < 2) return DenyMessage(playerid, 2);
if(!IsPlayerConnected(playa)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[playa][pAdmin]) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't jail a higher level Admin !");
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][pPrisonTime] = money;
PlayerInfo[playa][pPrison] = 1;
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
ResetPlayerWeapons(playa);
GameTextForPlayer(playa, "~r~Busted", 3000, 3);
SetPlayerInterior(playa, 3);
SetPlayerPos(playa, 198.5319,162.3093,1003.0300);
format(string, sizeof(string), "\"%s\" has been jailed by Admin \"%s\" for %d seconds.", giveplayer, sendername, money);
SendClientMessageToAll(COLOR_YELLOW, string);
SetTimerEx("UnJail",PlayerInfo[playa][pPrisonTime]*1000,0,"d",playa);
}
return 1;
}
if(strcmp(cmd, "/unjail", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unjail [playerid]");
new playa = ReturnUser(tmp);
if(PlayerInfo[playerid][pAdmin] < 2) return DenyMessage(playerid, 2);
if(!IsPlayerConnected(playa)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
if(playa != INVALID_PLAYER_ID)
{
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000); //Reset world to player
SetPlayerInterior(playa, 0);
SetPlayerPos(playa, 645.0193,-3114.3647,10.9957);
format(string, sizeof(string), "\"%s\" has been un-jailed by Admin \"%s\".", giveplayer, sendername);
SendClientMessageToAll(COLOR_YELLOW, string);
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/setadmin", true) == 0 || strcmp(cmd, "/makeadmin", true) == 0)
{
new player[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] < 10) return DenyMessage(playerid, 10);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin or /makeadmin [playerid] [AdminLevel]");
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, player, sizeof(player));
PlayerInfo[giveplayerid][pAdmin] = level;
printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
format(string, sizeof(string), "Admin \"%s\" has set your Admin Level to %d.",player, level);
SendClientMessage(giveplayerid, COLOR_GREEN, string);
format(string, sizeof(string), "You have given \"%s\" level %d admin.", giveplayer, PlayerInfo[giveplayerid][pAdmin]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}