Jail status sheck
#1

Hello!
Sorry for a long topic, i just want to make stuffs clear (hope i did).

Need help with this, because i cant get it to work.
everything needed for the user file works just fine, player gets "Jail=1" in the file when use the jail cmd.

Jail code seams also work fine (thanks to Calg00ne for point out the critical flaws)
pawn Код:
COMMAND:jail(playerid, params[])
{
    new id;
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /jail [id]");
    if(IsPlayerConnected(id))
    if(Jail[id] == 1) return SendClientMessage(playerid,red,"This user is already in jail!");
    if(PlayerInfo[playerid][Admin] >= 1)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(String, sizeof(String), "%s has jailed you",Name);
        SendClientMessage(id,green, String);
        Jail[id] = 1;
        ResetPlayerWeapons(id);
        SetPlayerPos(id, 412.99816894531,2543.0656738281,26.244613647461);
        SetPlayerColor(id,COLOR_BLUE);
        format(String, sizeof(String), "You have jailed %s",Name);
        SendClientMessage(playerid,green, String);
    }
    return 1;
}
Now when a player spawns, the script is checking if a player is a leader or in a team 1-3 and gives him the right
coords and skin,weps etc..

This code also work just fine!
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
    GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
    GivePlayerWeapon(playerid,30,200); //AK-47
    SetPlayerTeam(playerid, 0);
    SetPlayerColor(playerid, COLOR_RED);
    FSave[playerid] = SetTimerEx("Save",1000,true,"i",playerid);//This creates a timer when the player spawns and it saves the file ever 1 second.
    if(Member[playerid] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
    }
    if(Member[playerid] == 2)
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");
    }
    if(Member[playerid] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
    }
    if(Leader[playerid] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");*/
    }
    if(Leader[playerid] == 2)
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");*/
    }
    if(Leader[playerid] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");*/
         }
    return 1;
}
Now, if a player has "jail=1" in userfile, he should spawn in jail every time he joining the server, until he gets unjailed.

Here is the stuffs i need in "OnPlayerSpawn" if a jailed player spawns.
pawn Код:
if(Jail[id] == 1) //if player is jailed or not
    SetPlayerColor(playerid,COLOR_GREEN);
    SetPlayerPos(playerid, 412.99816894531,2543.0656738281,26.244613647461);
    SendClientMessage(playerid,COLOR_GREEN,"Welcome Back In Jail!.");
The code for a team member looks like this when he spawns "OnPlayerSpawn"
pawn Код:
if(Member[playerid] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
    }
But if he is jailed? how to check that? and let him spawn there and not at hes regular spawn?
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 414.6559,2531.7651,19.1601);
    GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
    GivePlayerWeapon(playerid,30,200); //AK-47
    SetPlayerTeam(playerid, 0);
    SetPlayerColor(playerid, COLOR_RED);
    FSave[playerid] = SetTimerEx("Save",1000,true,"i",playerid);//This creates a timer when the player spawns and it saves the file ever 1 second.
    if(Member[playerid] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");
    }
    if(Member[playerid] == 2)
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");
    }
    if(Member[playerid] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 255);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36,60); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27,100); //Combat Shotgun
        GivePlayerWeapon(playerid,30,200); //AK-47
        SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");
    }
    if(Leader[playerid] == 1)
    {
        SetPlayerColor(playerid,COLOR_GREY);
        SetPlayerTeam(playerid, 1);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1607.7803,1169.4840,14.2188);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_GREY,"Combat Team: Airwolves.");*/
    }
    if(Leader[playerid] == 2)
    {
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerTeam(playerid, 2);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, 1998.3118,-2352.3438,13.5469);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_DBLUE,"Combat Team: Bluefoxes.");*/
    }
    if(Leader[playerid] == 3)
    {
        SetPlayerColor(playerid,COLOR_YELLOW);
        SetPlayerTeam(playerid, 3);
        SetPlayerSkin(playerid, 61);
        SetPlayerPos(playerid, -1468.5074,-206.8094,14.1484);
        GivePlayerWeapon(playerid,36, 75); //HS Rocket Launcher **
        GivePlayerWeapon(playerid,27, 100); //Combat Shotgun
        GivePlayerWeapon(playerid, 38, 100); //Minigun
        GivePlayerWeapon(playerid, 30, 350); //AK-47
        /*SendClientMessage(playerid,COLOR_YELLOW,"Combat Team: Thunderbirds.");*/
     }
    if(Jail[id] == 1) //if player is jailed or not
    {
        SetPlayerColor(playerid,COLOR_GREEN);
        SetPlayerPos(playerid, 412.99816894531,2543.0656738281,26.244613647461);
        SendClientMessage(playerid,COLOR_GREEN,"Welcome Back In Jail!.");
    }
    return 1;
}
Try that
Reply
#3

Thanks!

but i have already tried that to
i getting error on "if(Jail[id] == 1)"
pawn Код:
error 017: undefined symbol "id"
Reply
#4

pawn Код:
new id;
?
Reply
#5

Use [playerid]
Reply
#6

Quote:
Originally Posted by AK47317
Посмотреть сообщение
pawn Код:
new id;
?
That made it! but it seams just work for ID 1
ID 1 jailed ID 0, ID 0 rejoined and spawned in jail
ID 0 Jailed ID 1, ID 1 rejoined and did not spawn in jail, but got status "in jail"

ID 1 jailed ID 1, ID 1 rejoined and spawned in jail
ID 0 jailed ID 0. ID 0 rejoined and spawned in jail
Reply
#7

Quote:
Originally Posted by Markx
Посмотреть сообщение
Use [playerid]
[playerid] doesnt work, bc if(Jail[id] == 1) is how to read from the playerfile, [playerid] doesnt do that
and [playerid] gives errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)