SA-MP Forums Archive
how can i make /escape command? - 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 can i make /escape command? (/showthread.php?tid=353844)



how can i make /escape command? - UserName31 - 24.06.2012

Hey i have been trying to make /escape command but i dont know i use dcmd(escape,cmdtext);
is that good for a escape commands? i want when people on jail they can do /escape and they will escape and the jail time set to 0 and setplayerwanted to 6 with jail time as a please wait before trying to escape form jail please help
is for my cops and robber server

so /escape = escape player from jail
when they escape they try 2 time i want them be like please wait before trying to escape from jail
and i want escape from jail fail please i need this script.

Thank you


Re: how can i make /escape command? - Badger(new) - 24.06.2012

Hello there.

I haven't seen any of your code, so I can't say what variables you are using to store data on the player (e.g. jail time, number of escape attempts), so I shall be writing code that you will have to modify yourself, but it will tell you what parts will need to go where.

I can't find the topic on DCMD, and I haven't used it myself, so for now I shall be writing the command how it would normally appear under "OnPlayerCommandText" since it has no parameters.

Make sure to read it all:
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]){
    if(!strcmp(cmdtext,"/Escape",true)){
       
        //If the player is not in jail, stop processing the command
        if( Is Player In Jail == 0){
            return SendClientMessage(playerid,0xFF0000FF,"You are not in jail.");
        }
       
        //If the player has already failed to escape from jail 2 times, stop processing the command
        if( Escape Attempts >=2){
            return SendClientMessage(playerid,0xFF0000FF,"You have already failed to escape from jail twice!");
        }
        //When the player is unjailed/connects to the server, you will need to set the variable for escape attempts to 0
       
        //Give the player a 1 in 4 chance of escaping (25%)
        new chance=random(4);
       
        //If the random function returns a value of 1 (returns values between 0-3: https://sampwiki.blast.hk/wiki/Random)
        if(chance==1){
            //The player has escaped jail
            Player Jail Time = 0;
            SetPlayerWantedLevel(playerid,6);
            GameTextForPlayer(playerid,"You have escaped from jail!~n~~r~Run!",5000,4);
            SetPlayerPos(playerid,x,y,z);//Set their position to outside the jail/police station
            SetPlayerInterior(playerid,0);
        }
        else {
            //The player failed to escape jail
            GameTextForPlayer(playerid,"~w~You ~r~failed~w~ to escape from jail!",5000,4);
            Escape Attempts++;
        }
       
        return 1;
    }
    return 0;
}



Re: how can i make /escape command? - UserName31 - 25.06.2012

ok here u go and thanks alot buddy i really thanks alot i am going to try it

Quote:

#include <a_samp>
#include <dudb>
#include <CPLoader>
#include <ladmin>

/*x---------------------------------Defining-------------------------------------x*/
//**COLORS*//
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000FFAA
#define blue 0x0000FFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_ORANGE 0xFF9933AA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLACK 0x2C2727AA
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_LEMON 0xDDDD2357
#define COLOR_AQUA 0x7CFC00AA
#define COLOR_WHITEYELLOW 0xFFE87DFF
#define COLOR_BLUEAQUA 0x7E60FFFF
#define COLOR_DARKBLUE 0x15005EFF
#define COLOR_ALIEN 0x90FF87FF
#define COLOR_GOLD 0xB8860BAA
#define KICK_COLOR 0xFF0000FF
#define COLOR_GANGGREEN 0x00FF0096
#define COLOR_BLACK 0x2C2727AA
#define COLOR_SBLUE 0x00BFFFAA

#define WHITE 0xF6F6F6AA
#define GREY 0xC6C6C6AA
#define RED 0xF60000AA
#define COLOR_ERROR 0xF60000AA
#define COLOR_RED 0xAA3333AA
#define LIGHT_BLUE 0x00A4F6AA
#define BLUE 0x0000F6AA
#define DARK_BLUE 0x0000AFAA
#define LIGHT_GREEN 0x00F600AA
#define GREEN 0x00AD00AA
#define DARK_GREEN 0x005000AA
#define YELLOW 0xF6F600AA
#define ORANGE 0xF67F00AA
#define BLACK 0x000000AA
#define COLOR_ROYALBLUE 0x4169FFAA
#define PINK 0xFF6EC7AA

#define SERVER_COLOR 0x85F600AA
#define ERROR 0x990000AA

#define COLOR_MSG 0x00FFFFFF //Color of general messages
#define STUNNED_TIME 4 //The time in seconds the stun lasts
#define ANTISPAM 5 //The minimum allowed time between /taze commands
#define COLOR_KILLED 0x880000FF //The color, when a player gets killed by tazing

#define CIVILIAN 0
#define Medic 1
#define COP 2
#define FBI 3
#define SWAT 4
#define ARMY 5
//--------------Taxi-----------
#define BAJADA_DE_BANDERA 500
#define PRECIO_FICHA 300
#define COLOR_YELLOW 0xFFFF00AA
//-----------------------------

/* ----------HIT COMMAND----------*/
#define COLOR_FOUND 0xFFFF00AA //Color of the message if a hit was found in /hits
#define COLOR_MSG 0x00FFFFFF //Color of general messages
#define ANTISPAM_TIME 5 //The minimum time between /hit commands to prevent spam (in seconds)
/*----------NO NEED TO EDIT FROM HERE----------*/

#define MAX_PLAYERS_ 50

#define SPAWN_GAS_MIN 35
#define SPAWN_GAS_MAX 100
#define MAX_START_TIME 3

#define BAJADA_DE_BANDERA2 500
#define PRECIO_FICHA2 300

#define RegisterName 1
#define LoginName 2

#define SendFormattedMessage(%0,%1,%2) do{new _str[128]; format(_str,128,%2); SendClientMessage(%0,%1,_str);}while(FALSE)

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

static gTeam[MAX_PLAYERS];

new GPSTimer[MAX_PLAYERS];
new bool:HaveGPS[MAX_PLAYERS];

enum aInfo
{
aLevel
}
;
new AccountInfo[MAX_PLAYERS][aInfo];

new RecentlyRobbed[MAX_PLAYERS];
new ATMRecentlyRobbed;
new DildoRecentlyRobbed;
new HallRecentlyRobbed;
new RentalRecentlyRobbed;
new BankRecentlyRobbed;
new BincoRecentlyRobbed;
new ZipRecentlyRobbed;
new UrbanRecentlyRobbed;
new AmmuRecentlyRobbed;
new Ammu2RecentlyRobbed;
new Ammu3RecentlyRobbed;
new Ammu4RecentlyRobbed;
new Ammu5RecentlyRobbed;
new DrugsRecentlyRobbed;
new D4RecentlyRobbed;
new CaRecentlyRobbed;

new gPlayerUsingLoopingAnim[MAX_PLAYERS];
new animation[200];

//BUS
new OnBusAsPassenger[MAX_PLAYERS];
new CostoDelViaje2[MAX_PLAYERS];
new contador2[MAX_PLAYERS];
new playerInMiniMission2[MAX_PLAYERS];
new avisado2[MAX_PLAYERS];
new caidadeficha2Timer2;
new cantidadPasajeros2;

forward terminarMission2(playerid);
forward caidadeficha2();
//

new IsSpawned[MAX_PLAYERS];

new SelectBM[MAX_PLAYERS];

new PlayerSkin[MAX_PLAYERS];

new SelectTM[MAX_PLAYERS];

new InTrashMission[MAX_PLAYERS];

new time;

new Muted[MAX_PLAYERS];

new ticketmen[MAX_PLAYERS];

//Lotto
#define yellow 0xFFFF00AA
#define green 0x33FF33AA
#define white 0xFFFFFFAA
#define red 0xFF0000AA
#define grgreen 0x33AA33AA

#define SORSOLASTIMER 120000 // 2 perc
#define HIRDETESTIMER 180000 // 3 min
#define ALTERNATIVE_MAX_PLAYERS 500
//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

new bool:HaveTicket[ALTERNATIVE_MAX_PLAYERS];
new NyeroSzamok[6][ALTERNATIVE_MAX_PLAYERS];
new KisorsoltSzamok[6];
new TimerKill[2];
new output2[128];

forward Sorsolas();
forward GPSUpdate(playerid,playerid2);
//


//Text Draws
new Text:BOX;
new Text:Welcome;
new Text:text1;
new Text:text2;
new Text:text3;
new Text:BOX2;
new Text:CIVBOX;
new Text:text6;
new Text:text7;
new Text:text8;
new Text:text9;
new Text:text10;
new Text:HALLBOX;
new Text:COPBOX;
new Text:MDCBOX;
new Text:text11;
new Text:text13;
new Text:text14;
new Text:text15;
new Text:text16;
new Text:text17;
new Text:text18;
new Text:text19;
new Text:text20;
new Text:text21;
new Text:text22;
new Text:text23;
new Text:CMDBOX;
new Text:BUSBOX;
new Text:text24;
new Text:text25;
new Text:text26;
new Text:text27;
new Text:BBOX;
new Text:text35;
new Text:text37;
new Text:text38;
new Text:text39;
new Text:text40;
new Text:AMMUBOX1;
new Text:AMMUBOX2;
new Text:text41;
new Text:text42;
new Text:text43;
new Text:PCBOX;
new Text:text44;
new Text:text45;

new Text:randommsg;

new CSKIN[MAX_PLAYERS];
new CSKINZ[MAX_PLAYERS];
new CSKINU[MAX_PLAYERS];
new AMMUBOX[MAX_PLAYERS];
new AMMU[MAX_PLAYERS];

new hit[MAX_PLAYERS];
new hiter[MAX_PLAYERS];
new antispam[MAX_PLAYERS];

new CHALLBOX[MAX_PLAYERS];

//--------------Taxi-----------
new OnTaxiAsPassenger[MAX_PLAYERS];
new CostoDelViaje[MAX_PLAYERS];
new contador[MAX_PLAYERS];
new playerInJob[MAX_PLAYERS];
new avisado[MAX_PLAYERS];
new caidadefichaTimer;
new cantidadPasajeros;
//-----------------------------

new PrisonTime[MAX_PLAYERS];
new BlowTime[MAX_PLAYERS];
new IsPlayerLogged[MAX_PLAYERS];
new BankRecentlyUsed[MAX_PLAYERS];
new RentedACarRecently[MAX_PLAYERS];
new InsideBar[MAX_PLAYERS];
new Working[MAX_PLAYERS];

new RobDildo[MAX_PLAYERS];
new RobHall[MAX_PLAYERS];
new RobRental[MAX_PLAYERS];
new RobBank[MAX_PLAYERS];
new RobBinco[MAX_PLAYERS];
new RobZip[MAX_PLAYERS];
new RobUrban[MAX_PLAYERS];
new RobAmmu[MAX_PLAYERS];
new RobAmmu2[MAX_PLAYERS];
new RobAmmu3[MAX_PLAYERS];
new RobAmmu4[MAX_PLAYERS];
new RobAmmu5[MAX_PLAYERS];
new RobDrugs[MAX_PLAYERS];
new RobD4[MAX_PLAYERS];
new RobCa[MAX_PLAYERS];

new PlayersOnline = 0;

new stunned[MAX_PLAYERS];
new tazetime[MAX_PLAYERS];

new currentcheckpoint[MAX_PLAYERS];
new InBusMission[MAX_PLAYERS];

new RandomMessages[][] =
{
"~p~ Remember To ~g~ Read~p~ The ~g~Rules!.",
"~p~ Why Not Visit Our Forum?: ~b~http://cabcnr.forumotion.com/",
"~p~ /cmds To See Our Commands!",
"~p~ Request Your Own Skin At Forum!~b~ http://cabcnr.forumotion.com/f6-skin-request.",
"~p~ Its There Admin Messing With You Go to~r~ Forum! http://cabcnr.forumotion.com/!"
// You can define more messages, but make sure you have , everywhere, except at the last message
};