[pawn]else if (strcmp(cmd, "carcel", true) == 0) {
{
new time[256],reason[256],plr;
tmp = strtok(cmdtext, idx),plr = FindPlayerIDFromString(tmp),time = strtok(cmdtext, idx),reason = strtok(cmdtext, idx);
if(Jail[plr] == 1) {
SendClientMessage(playerid,NOTACCES,"Este Jugador Ya Esta Arrestado");
}
if(Jail[plr] == 0) {
if (!strlen(tmp) || !strlen(time) || !strlen(reason)) SendClientMessage(playerid,COLOR_RED, "escribe: /c carcel [Nick] [Minutos] [Razon]");
else if ( !IsAuthorized( playerid, "ahogar" ) ) SendClientMessage( playerid, COLOR_RED, "Tu no tienes Suficiente Nivel Para Usar Este Comando" );
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: jugador desconocido");
else {
new string[256];
SetPlayerRandomJailSpawns(plr);
SetPlayerWeapon(plr,0,0);
SetPlayerWeapon(plr,0,0);
SetPlayerWeapon(plr,0,0);
format(string,sizeof(string),"%s ha Arrestado a %s Por %d Minutos",gPlayers[playerid],gPlayers[plr],strval(time));
SendClientMessageToAll(COLOR_YELLOW, string);
format(string,sizeof(string),"Razon:[ %s ].",cmdtext[strlen(tmp)+7]);
SendClientMessageToAll(COLOR_YELLOW, string);
SendClientMessage(plr,RED,"Tu has sido Arrestado");
SetTimer("unjail",(strval(time)*60000),false);
Jail[plr] = 1;
TogglePlayerControllable(plr,0);
}
}
}
return 1;
}
else if(strcmp(cmd, "liberar", true) == 0) {
{
tmp = strtok(cmdtext, idx); new plr = FindPlayerIDFromString(tmp);
if(Jail[plr] == 0) {
SendClientMessage(playerid,NOTACCES,"Este Jugador a sido puesto en libertad");
}
if(Jail[plr] == 1) {
if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED, "Escribe: /c liberar [Nick]");
else if ( !IsAuthorized( playerid, "ahogar" ) ) SendClientMessage( playerid, COLOR_RED, "Tu no tienes Suficiente Nivel Para Usar Este Comando" );
else{
if (plr != INACTIVE_PLAYER_ID) {
new string[256];
format(string,sizeof(string),"%s ha Liberado a %s!",gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerPos(plr,397.688, -471.821, 11.5172,0,0);
SendClientMessage(plr,COLOR_YELLOW,"Tu Has Sido Liberado,No vuelvas a cometer delitos.!");
Jail[plr] = 0;
TogglePlayerControllable(plr,1);
}
else SendClientMessage(playerid,COLOR_RED,"Error: Jugador desconocido");
}
}
}
return 1;
}[/pawn]
[pawn]new RandomPlayerJailSpawns[][playerjailspawns] = {
{387.0193,-510.2893,9.3956},
{388.4367,-511.6012,9.3956},
{389.7545,-509.8963,9.3956},
{388.2702,-508.7623,9.3956},
{389.5057,-507.1813,9.3956},
{390.9967,-508.3748,9.3956},
{392.1059,-506.9302,9.3956},
{390.8487,-505.9404,9.3956},
{392.1864,-504.1500,9.3956},
{393.5389,-505.2466,9.3956},
{395.1618,-504.3013,9.3956},
{382.1467,-505.1280,9.3956},
{384.9164,-502.2434,9.3956},
{387.6998,-499.4460,9.3956}
};
forward SetPlayerRandomJailSpawns(playerid);
forward unjail();[/pawn]
[pawn]#define NOTACCES 0xFF0000AA[/pawn]
[pawn]//==============================================================================
public SetPlayerRandomJailSpawns(playerid)
{
new rand = random(sizeof(RandomPlayerJailSpawns));
SetPlayerPos(playerid,RandomPlayerJailSpawns[rand][spawnxj],RandomPlayerJailSpawns[rand][spawnyj],RandomPlayerJailSpawns[rand][spawnzj],0,0); // Minigun
return 1;
}
//==============================================================================
public unjail() {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(Jail
== 0) {
}
if(Jail == 1) {
SetPlayerPos(i,397.688, -471.821, 11.5172,0,0);
SendClientMessage(i,COLOR_YELLOW,"Has salido de la carcel, no vuelvas a cometer delitos!!");
Jail = 0;
TogglePlayerControllable(i,1);
}
}
}
}
//==============================================================================[/pawn] so, you have more place to random jail