Author Topic: Advanced Jail System By Moby (me)  (Read 4157 times)

0 Members and 1 Guest are viewing this topic.

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Advanced Jail System By Moby (me)
« on: August 01, 2012, 12:06:47 am »
Advanced Jail System


Commands: /c jail [Nick/ID] , /c unjail [Nick/ID] => Commands for rcon admins !

What is new in this UPDATE ?

*You decide how many minutes to stay in jail and You can add Reason with why you jailed the player !

Now , you have a Random JailSpawns , because, in the Simple Jail System you have just one place, now you have much more places.

Type on your gm top this:


Code: [Select]
#define NOTACCES 0xFF0000AA

new Jail[MAX_PLAYERS];


enum playerjailspawns {
Float:spawnxj,
Float:spawnyj,
Float:spawnzj,
}


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();

OnPlayerDisconnect:

Code: [Select]
Jail[playerid] = 0;
Now, add Commands !

Commands:


Code: [Select]
else if (strcmp(cmd, "jail", true) == 0) {
    if(IsPlayerAdmin(playerid))
    {
    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,"This Player Is In Jail !");
    }
    if(Jail[plr] == 0) {
if (!strlen(tmp) || !strlen(time) || !strlen(reason)) SendClientMessage(playerid,COLOR_RED, "USAGE: /c jail [Nick] [Min] [Reason]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else {
new string[256];
SetPlayerRandomJailSpawns(plr);
SetPlayerWeapon(plr,0,0);
SetPlayerWeapon(plr,0,0);
SetPlayerWeapon(plr,0,0);
format(string,sizeof(string),"Admin %s has jailed %s fo r%d",minutes.",gPlayers[playerid],gPlayers[plr],strval(time));
SendClientMessageToAll(COLOR_YELLOW, string);
format(string,sizeof(string),"Reason:[ %s ].",cmdtext[strlen(tmp)+7]);
SendClientMessageToAll(COLOR_YELLOW, string);
SendClientMessage(plr,COLOR_YELLOW,"You have been jailed !");
SetTimer("unjail",(strval(time)*60000),false);
Jail[plr] = 1;
TogglePlayerControllable(plr,0);
}
}
}else{
SendClientMessage(playerid,NOTACCES,"***Not have permission to use this command!");
}
return 1;
}
else if(strcmp(cmd, "unjail", true) == 0) {
    if(IsPlayerAdmin(playerid))
    {
    tmp = strtok(cmdtext, idx); new plr = FindPlayerIDFromString(tmp);
    if(Jail[plr] == 0) {
    SendClientMessage(playerid,NOTACCES,"This Player Is Not In Jail !");
    }
    if(Jail[plr] == 1) {
    if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED, "USAGE: /c unjail [Nick]");
    else{
        if (plr != INACTIVE_PLAYER_ID) {
            new string[256];
        format(string,sizeof(string),"Admin %s has unjailed %s!",gPlayers[playerid],gPlayers[plr]);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerPos(plr,397.688, -471.821, 11.5172,0,0);
SendClientMessage(plr,COLOR_YELLOW,"You have been unjailed !");
Jail[plr] = 0;
TogglePlayerControllable(plr,1);
}
else SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
}
}
}else{
SendClientMessage(playerid,NOTACCES,"***Not have permission to use this command!");
}
return 1;
}

Now, the publics :

Code: [Select]
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[i] == 0) {
    }
    if(Jail[i] == 1) {
SetPlayerPos(i,397.688, -471.821, 11.5172,0,0);
SendClientMessage(i,COLOR_YELLOW,"You have been unjailed ! Time Expired !");
Jail[i] = 0;
TogglePlayerControllable(i,1);
}
}
}
}

Finish !

Code: [Select]
This was my first system :D !

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline dynavolt71

  • Crime Boss
  • ****
  • Posts: 371
    • View Profile
    • My Blog
Re: Advanced Jail System By Moby (me)
« Reply #1 on: October 14, 2012, 06:13:26 am »
,minutes.
its for ? im trying to make it and Result : its make some erors
« Last Edit: October 14, 2012, 06:15:30 am by dynavolt71 »
[PAWNO]Fix Error " Failed to set data for "" " - http://forum.vicecitymultiplayer.com/index.php?topic=5743.0



:'(