SA-MP Forums Archive
Huge jail fail - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Huge jail fail (/showthread.php?tid=247105)



Huge jail fail - cruising - 07.04.2011

Im getting tired of try over and over again, i need some one to look at this cmd and help me to fix it before i rips off me my hair!
The thing is that when someone dies, that has not been jailed, he spawns in the jail and not in his proper place, cant figure out why :S maybe the whole code is scripted total wrong, i don't know.

And the jailer gets "you have jailed "urself"" and not the players name, the jailed one gets the right message.
And i can only jail ID 0 and 1, if i jail ID 2 nothing happens and no message appears, if i try ID 3 who is not online, you got a message who tells "SERVER: Unknown command" as it should do!

Im stranded and making a distress call, and hoping some one will help me finish this problem once for all.
pawn Код:
COMMAND:jail(playerid, params[])
{
    new id;
    if(PlayerInfo[playerid][Admin] == 0)return SendClientMessage(playerid, 0xFF0000FF, "Only admin 1 can use this command!!");
    if(sscanf(params,"u", id))return SendClientMessage(playerid, 0x33CCFFAA, "Usage: /jail [id]");
    if(IsPlayerConnected(id))
    if(Jail[id] == 1) return SendClientMessage(playerid,red,"That Player is already in jail!");
    if(PlayerInfo[id][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);
        format(String, sizeof(String), "You have jailed %s",Name);
        SendClientMessage(playerid,green, String);
    }
    return 1;
}



Re: Huge jail fail - Cameltoe - 07.04.2011

Try :

pawn Код:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,red,"Player is not connected");
Also, shouldn't

pawn Код:
if(PlayerInfo[id][Admin] >= 1)
Be

pawn Код:
if(PlayerInfo[playerid][Admin] >= 1)
??


Re: Huge jail fail - cruising - 07.04.2011

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Try :

pawn Код:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,red,"Player is not connected");
Also, shouldn't

pawn Код:
if(PlayerInfo[id][Admin] >= 1)
Be

pawn Код:
if(PlayerInfo[playerid][Admin] >= 1)
??
Yeah you are right, it should be [playerid] when it is your self. Its not "not connected" message i want, i want that not all players spawn in jail when they die just because i have jailed 1 player. And i just noticed that if it is 3 on server, i can only jail 2 of 3. and if 4 i can only jail 3 of 4. this is sick :S


Re: Huge jail fail - Cameltoe - 07.04.2011

Show me your on player spawn then ?


Re: Huge jail fail - cruising - 07.04.2011

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
Show me your on player spawn then ?
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.");*/
    }
    new id;
    if(Jail[id] == 1) //if player is jailed or not
    {
        SetPlayerPos(playerid, 412.99816894531,2543.0656738281,26.244613647461);
        SendClientMessage(playerid,COLOR_GREEN,"Welcome Back In Jail!.");
    }
    return 1;
}



Re: Huge jail fail - Cameltoe - 07.04.2011

pawn Код:
if(Jail[playerid] == 1) //if player is jailed or not
    {
        SetPlayerPos(playerid, 412.99816894531,2543.0656738281,26.244613647461);
        SendClientMessage(playerid,COLOR_GREEN,"Welcome Back In Jail!.");
    }



Re: Huge jail fail - cruising - 07.04.2011

Quote:
Originally Posted by Cameltoe
Посмотреть сообщение
pawn Код:
if(Jail[playerid] == 1) //if player is jailed or not
    {
        SetPlayerPos(playerid, 412.99816894531,2543.0656738281,26.244613647461);
        SendClientMessage(playerid,COLOR_GREEN,"Welcome Back In Jail!.");
    }
i cant have
pawn Код:
if(Jail[playerid] == 1)
then it doesnt read from the user file if he has "Jail=1" i guess

EDIT: It did work! And i have to say THANK YOU SO MUCH! now i dont have to rip my hair of lol