15.08.2010, 02:33
if(strcmp(cmd, "/jail", true) == 0) // Jails a player
{
if (adminlevel[playerid] >= 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /jail [name/id] [reason]");
return 1;
}
new targetid = ReturnUser(tmp);
if(IsPlayerConnected(targetid))
{
if(targetid != INVALID_PLAYER_ID)
{
if(jail[giveplayerid] == 0)
{
GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
new reason[128];
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [name/id] [reason]");
format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
SendClientMessage(targetid, ADMIN_RED, string);
format(string, sizeof(string), "Administrator %s jailed %s. [ Reason: %s ]",sendername,giveplayername, reason);
SendClientMessageToAll(ADMIN_RED,string);
jail[targetid] = 1;
OnPlayerJailed(targetid);
return 1;
}
else SendClientMessage(playerid, RED, "Player is already jailed!");
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
return 1;
}
if(strcmp(cmd, "/unjail", true) == 0) // Unjails a player
{
if (adminlevel[playerid] >= 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /unjail [name/id]");
return 1;
}
new targetid = ReturnUser(tmp);
if(targetid != INVALID_PLAYER_ID)
{
if(jail[giveplayerid] == 1)
{
GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Administrator %s unjailed %s",sendername, giveplayername);
SendClientMessageToAll(ADMIN_RED,string);
jail[targetid] = 0;
OnPlayerUnjailed(targetid);
}
else SendClientMessage(playerid, RED, "Player is not jailed!");
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You cannot use this command!");
return 1;
}
this is my jail commands to jail a player which admins can only do ! the /jail command works correctly but /unjail is not working ! i cannot unjail a person ! i cannot find the problem and i dont know how to fix it ! So please help !
{
if (adminlevel[playerid] >= 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /jail [name/id] [reason]");
return 1;
}
new targetid = ReturnUser(tmp);
if(IsPlayerConnected(targetid))
{
if(targetid != INVALID_PLAYER_ID)
{
if(jail[giveplayerid] == 0)
{
GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
new reason[128];
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [name/id] [reason]");
format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
SendClientMessage(targetid, ADMIN_RED, string);
format(string, sizeof(string), "Administrator %s jailed %s. [ Reason: %s ]",sendername,giveplayername, reason);
SendClientMessageToAll(ADMIN_RED,string);
jail[targetid] = 1;
OnPlayerJailed(targetid);
return 1;
}
else SendClientMessage(playerid, RED, "Player is already jailed!");
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You are not an admin with the required level.");
return 1;
}
if(strcmp(cmd, "/unjail", true) == 0) // Unjails a player
{
if (adminlevel[playerid] >= 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /unjail [name/id]");
return 1;
}
new targetid = ReturnUser(tmp);
if(targetid != INVALID_PLAYER_ID)
{
if(jail[giveplayerid] == 1)
{
GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Administrator %s unjailed %s",sendername, giveplayername);
SendClientMessageToAll(ADMIN_RED,string);
jail[targetid] = 0;
OnPlayerUnjailed(targetid);
}
else SendClientMessage(playerid, RED, "Player is not jailed!");
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "You cannot use this command!");
return 1;
}
this is my jail commands to jail a player which admins can only do ! the /jail command works correctly but /unjail is not working ! i cannot unjail a person ! i cannot find the problem and i dont know how to fix it ! So please help !