SA-MP Forums Archive
how make you are not in jail! - 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)
+--- Thread: how make you are not in jail! (/showthread.php?tid=358798)



how make you are not in jail! - UserName31 - 11.07.2012

hey how can i make if player is not in jail to send client message you cant usething command you are not in jail please

PHP код:
dcmd_escape(playerid,params[])
{
    
#pragma unused params
    
new string[128];
    new 
ID;
    if(
InAdminMode[ID] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ERROR]:You cannot use this command on this player because they are in Administrator mode.");
        return 
1;
    }
    if(
IsSpawned[playerid] != 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ERROR]:You must be alive and spawned in order to be able to use this command.");
        return 
1;
     }
    if(
IsKidnapped[playerid] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ERROR]:You are kidnapped. You cannot use this command.");
        return 
1;
    }
    if(
IsFrozen[playerid] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"{ERROR}:You have been frozen by a Server Administrator. You cannot use this command.");
        return 
1;
    }
    if(
gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC)
    {
         
SendClientMessage(playerid,COLOR_RED,"[ERROR]: You Cannot Escape Only Civilians can!");
        return 
1;
    }
    if(
AttemptedToRobRecently[playerid] >= 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[Tired]:You are too tired from your last Escape attempt. Please wait before trying to escape again.");
        return 
1;
    }
    new 
crand random(100);
    if(
crand <= 30)
    {
        
SendClientMessage(playerid,COLOR_RED,"[FAIL]:Escape attempt failed. Cops Has Return you to jail With more time!.");
        
AttemptedToRobRecently[playerid] =125;
        return 
1;
    }
    
format(string,sizeof(string),"[Civilian ACTION!]%s(%d) has Escape From San Fierro Prison!.",PlayerName(playerid),playerid,PlayerName(ID),ID);
    
SendClientMessageToAll(COLOR_ORANGE,string);
    
format(string,sizeof(string),"7[Civilian ACTION!] %s(%d) has Escape From San Fierro Prison!.",PlayerName(playerid),playerid,PlayerName(ID),ID);
    
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    
GameTextForPlayer(playerid,"~r~ escaped!",1000,4);
    
SendClientMessage(playerid,COLOR_RED,"[ESCAPED!]:You Have Escape From SFPD Jail! Run Cops Are on there way!");
    
IncreaseWantedLevel(playerid,8);
    
HasRobbedRecently[playerid] =23;
    
IncreasePlayerScore(playerid,2);
    
TotalJailTime[playerid] =0;
    
JailTime[playerid] =0;
    
TextDrawHideForPlayer(playerid,JailTimer[playerid]);
    
SetPlayerPos(playerid,225.8451,112.8976,1003.2188);
    
SetPlayerFacingAngle(playerid,1.0816);
    
SetCameraBehindPlayer(playerid);
    return 
1;


i made /escape command and it work perfect all i need it to not use it out side like if u are not in jail u cant use this command


Re: how make you are not in jail! - clarencecuzz - 11.07.2012

pawn Код:
if(JailTime[playerid] == 0) return
SendClientMessage(playerid, 0xFF0000AA, "You cannot use this command if you are not jailed!");



Re: how make you are not in jail! - UserName31 - 11.07.2012

OMG!! Thanks alot!

here what i did thanks you on my rep list

PHP код:
dcmd_escape(playerid,params[])
{
    
#pragma unused params
    
new string[128];
    new 
ID;
    new 
i;
    if(
InAdminMode[ID] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ERROR]:You cannot use this command on this player because they are in Administrator mode.");
        return 
1;
    }
    if(
IsSpawned[playerid] != 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ERROR]:You must be alive and spawned in order to be able to use this command.");
        return 
1;
     }
    if(
IsKidnapped[playerid] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[ERROR]:You are kidnapped. You cannot use this command.");
        return 
1;
    }
    if(
IsFrozen[playerid] == 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"{ERROR}:You have been frozen by a Server Administrator. You cannot use this command.");
        return 
1;
    }
    if(
gTeam[playerid] == TEAM_COP || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC)
    {
         
SendClientMessage(playerid,COLOR_RED,"[ERROR]: You Cannot Escape Only Civilians can!");
        return 
1;
    }
    if(
AttemptedToRobRecently[playerid] >= 1)
    {
        
SendClientMessage(playerid,COLOR_RED,"[Tired]:You are too tired from your last Escape attempt. Please wait before trying to escape again.");
        return 
1;
    }
    new 
crand random(100);
    if(
crand <= 30)
    {
        
SendClientMessage(playerid,COLOR_RED,"[FAIL]:Escape attempt failed. Cops Has Return you to jail With more time!.");
        
AttemptedToRobRecently[playerid] =125;
        return 
1;
    }
     if(
JailTime[i] == 1)
    {
    
format(string,sizeof(string),"[Civilian ACTION!]%s(%d) has Escape From San Fierro Prison!.",PlayerName(playerid),playerid,PlayerName(ID),ID);
    
SendClientMessageToAll(COLOR_ORANGE,string);
    
format(string,sizeof(string),"7[Civilian ACTION!] %s(%d) has Escape From San Fierro Prison!.",PlayerName(playerid),playerid,PlayerName(ID),ID);
    
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    
GameTextForPlayer(playerid,"~r~ escaped!",1000,4);
    
SendClientMessage(playerid,COLOR_RED,"[ESCAPED!]:You Have Escape From SFPD Jail! Run Cops Are on there way!");
    
IncreaseWantedLevel(playerid,8);
    
HasRobbedRecently[playerid] =23;
    
IncreasePlayerScore(playerid,2);
    
TotalJailTime[playerid] =0;
    
JailTime[playerid] =0;
    
TextDrawHideForPlayer(playerid,JailTimer[playerid]);
    
SetPlayerPos(playerid,225.8451,112.8976,1003.2188);
    
SetPlayerFacingAngle(playerid,1.0816);
    
SetCameraBehindPlayer(playerid);
    }
    else
    if(
JailTime[playerid] == 0) return
    
SendClientMessage(playeridCOLOR_RED"[ERROR]:You are not in jail!");
    return 
1;