Help with my Jail command
#1

Howdy Folks, I came here with a question about my Jail command that i am Completely Stumped about.

Here is the /jail Command.
pawn Код:
CMD:jail(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >=5)
    {
        new id,reason[128],time,on[MAX_PLAYER_NAME],n[MAX_PLAYER_NAME],string[128];
        if(sscanf(params,"uds[128]",id,time,reason)) return SendClientMessage(playerid,COLOR_RED,"Usage:/Jail [ID] [Time] [Reason]");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        else
        {
            GetPlayerName(playerid,n,sizeof(n));
            GetPlayerName(id,on,sizeof(on));
            SetPlayerPos(id,227.69999694824,109,999.09997558594);
            PlayerInfo[id][pJailTime] = time;
            PlayerInfo[id][pJail] = 1;
            SetPlayerInterior(id,10);
            SetPlayerVirtualWorld(id, 2);
            JailTime[id] = SetTimer("JailTime", time, false);
            format(string, sizeof(string), "AdminCMD: %s has Jailed %s because: %s",n,on,reason);
            SendClientMessageToAll(COLOR_ORANGE,string);
        }
    }
    return 1;
}
Heres the Unjail part of the Timer.



pawn Код:
new JailTime[MAX_PLAYERS];
pawn Код:
forward Jailtime(playerid);
public Jailtime(playerid)
{
    SetPlayerPos(playerid,1552.4500,-1674.9900,16.1953);
    PlayerInfo[playerid][pJail] = 0;
    SetPlayerInterior(playerid,0);
    SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid,COLOR_RED,"You Were Released From Admin Jail");
    return 1;
}
Reply
#2

pawn Код:
JailTime[id] = SetTimer("JailTime", time, false);
into
pawn Код:
JailTime[id] = SetTimerEx("JailTime", time, false,"d",id);
Reply
#3

Strange, I still do not get released. Any other Suggestions?
Reply
#4

The way you named it is the problem. You called the timer "JailTime", as shown below:

pawn Код:
JailTime[id] = SetTimer("JailTime", time, false);
But you named the timer callback "Jailtime".

Remember, pawn is case sensitive. Also, I've added some changes into your timer callback, it checks to see if the player is jailed by using your pJail variable:

pawn Код:
forward JailTime(playerid);
public JailTime(playerid)
{
    if(PlayerInfo[playerid][pJail] == 1)
    {
        SetPlayerPos(playerid,1552.4500,-1674.9900,16.1953);

        SetPlayerInterior(playerid,0);

        SetPlayerVirtualWorld(playerid, 0);

        SendClientMessage(playerid,COLOR_RED,"You Were Released From Admin Jail");

        PlayerInfo[playerid][pJail] = 0;
        PlayerInfo[id][pJailTime] = 0;
    }
    return 1;
}
Reply
#5

And, What is wrong with this Coding?

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pJail] ==1)
    {
        new id;
        SetPlayerInterior(playerid,10);
        SetPlayerVirtualWorld(id, 2);
        SetPlayerPos(id,227.69999694824,109,999.09997558594);
    }
    else if
    {
        if(PlayerInfo[playerid][pAdmin] <=1)
        {
            SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
        }
    }
    else
    {
        SetPlayerInterior(playerid,0);
    }
    return 1;
}
Its been a while since i coded :P
Reply
#6

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pJail] == 1)
    {
        new id;
        SetPlayerInterior(playerid,10);
        SetPlayerVirtualWorld(id, 2);
        SetPlayerPos(id,227.69999694824,109,999.09997558594);
    }
    if(PlayerInfo[playerid][pAdmin] <= 1)
    {
        SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
    }
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        SetPlayerInterior(playerid,0);
    }
    return 1;
}
Reply
#7

And Finally One Last Thing.

Im trying to Set my Vehicles to VirutalWorld 4. Im trying to do it like this.

pawn Код:
new FaythGarageCars[19 + 1];
pawn Код:
FaythGarageCars[19] = CreateVehicle(598,-1718.19995117,722.00000000,147.69999695,0.00000000,-1,-1,15); //Police Car (LVPD)
    FaythGarageCars[18] = CreateVehicle(599,-1705.90002441,722.29998779,148.19999695,0.00000000,-1,-1,15); //Police Ranger
    FaythGarageCars[17] = CreateVehicle(402,-1693.69995117,721.20001221,147.80000305,0.00000000,-1,1,15); //Buffalo
    FaythGarageCars[16] = CreateVehicle(411,-1685.50000000,721.29998779,147.69999695,0.00000000,-1,1,15); //Infernus
    FaythGarageCars[15] = CreateVehicle(451,-1681.50000000,703.00000000,147.60000610,0.00000000,-1,1,15); //Turismo
    FaythGarageCars[14] = CreateVehicle(477,-1689.69995117,703.29998779,147.69999695,0.00000000,-1,1,15); //ZR-350
    FaythGarageCars[13] = CreateVehicle(506,-1710.00000000,703.29998779,147.69999695,0.00000000,-1,1,15); //Super GT
    FaythGarageCars[12] = CreateVehicle(541,-1718.40002441,703.00000000,147.60000610,0.00000000,-1,-1,15); //Bullet
    FaythGarageCars[11] = CreateVehicle(558,-1734.80004883,689.40002441,147.60000610,0.00000000,-1,1,15); //Uranus
    FaythGarageCars[10] = CreateVehicle(559,-1726.80004883,688.40002441,147.60000610,0.00000000,-1,1,15); //Jester
    FaythGarageCars[9] = CreateVehicle(560,-1718.30004883,689.00000000,147.69999695,0.00000000,-1,1,15); //Sultan
    FaythGarageCars[8] = CreateVehicle(562,-1710.40002441,688.40002441,147.60000610,0.00000000,-1,1,15); //Elegy
    FaythGarageCars[7] = CreateVehicle(579,-1701.59997559,689.70001221,148.00000000,0.00000000,-1,1,15); //Huntley
    FaythGarageCars[6] = CreateVehicle(601,-1690.09997559,689.50000000,147.80000305,0.00000000,-1,-1,15); //S.W.A.T. Van
    FaythGarageCars[5] = CreateVehicle(597,-1681.30004883,688.50000000,147.69999695,0.00000000,-1,-1,15); //Police Car (SFPD)
    FaythGarageCars[4] = CreateVehicle(490,-1673.09997559,688.79998779,148.19999695,0.00000000,-1,-1,15); //FBI Rancher
    FaythGarageCars[3] = CreateVehicle(490,-1664.80004883,689.29998779,148.19999695,0.00000000,-1,-1,15); //FBI Rancher
    FaythGarageCars[2] = CreateVehicle(432,-1659.59997559,699.70001221,148.00000000,90.00000000,-1,-1,15); //Rhino
    FaythGarageCars[1] = CreateVehicle(432,-1659.69995117,711.90002441,148.00000000,90.00000000,-1,-1,15); //Rhino
    FaythGarageCars[0] = CreateVehicle(578,-1665.59997559,736.09997559,148.60000610,0.00000000,-1,1,15); //DFT-30
    SetVehicleVirtualWorld(FaythGarageCars[20],4);
But, Im Getting

pawn Код:
C:\Users\Chris\Desktop\Server\gamemodes\Gangwar.pwn(329) : error 032: array index out of bounds (variable "FaythGarageCars")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

pawn Код:
for(new v=0; v<20; v++);
{
SetVehicleVirtualWorld(FaythGarageCars[v],4);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)