Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------------------------------------------------------------------------//
- #include <a_samp>
- #define colore 0xFFFF22AA
- #define PlayerToPoint
- #pragma tabsize 0
- //----------------------------------------------------------------------------//
- new bottino = 300000; // Bottino della rapina, modificabile
- new temporapina = 180000; // Tempo della rapina in millisecondi, modificabile (default = 900000 millisecondi)
- new rapinaincorso = 0; // NON MODIFICARE
- new israpinatore[MAX_PLAYERS]; // NON MODIFICARE
- new rapinatimer[MAX_PLAYERS]; // NON MODIFICARE
- new polcount; // NON MODIFICARE
- new randmax = 50000; // Margine massimo per il bottino casuale, modificabile [IMPORTANTE: Randmax deve essere MAGGIORE di Randmin]
- new randmin = 20000; // Margine minimo per il bottino casuale, modificabile [IMPORTANTE: Randmin deve essere MINORE di Randmax]
- new bottinocasuale = 0; // Bottino casuale si/no, 1 per attivarlo, 0 per disattivarlo, modificabile
- new copsminimi = 2; // Numero minimo di poliziotti connessi nel server per poter rapinare la banca, modificabile
- new bloccorapina = 0; // NON MODIFICARE
- forward IsPolice(playerid);
- forward IsInBank(playerid);
- forward IsArmed(playerid);
- forward RapinaTime(playerid);
- forward BankAreaCheck();
- forward CopsConnected();
- forward RapinaOn();
- //----------------------------------------------------------------------------//
- public IsInBank(playerid) {
- new Float:px;
- new Float:py;
- new Float:pz;
- GetPlayerPos(playerid, px, py, pz);
- // Coordinate che delimitano il cubo in cui ? contenuto l'interior della banca
- // Modificate a vostro rischio!
- if (PlayerToPoint(100.0, playerid,1490.2883,1305.6349,1093.2964)) return 1;// Devi modificare il numero 100.0 è la grandezza della banca, misuralo in base le dimensioni della stanza.
- else return 0;
- }
- public IsPolice(playerid) {
- new pskin = GetPlayerSkin(playerid);
- // Skins dei poliziotti, cambiate, togliete o aggiungete SkinID se necessario
- if ((pskin == 266) || (pskin == 265) || (pskin == 267) || (pskin == 71) || (pskin == 163) || (pskin == 246) || (pskin == 166) || (pskin == 165) || (pskin == 164) || (pskin == 280) || (pskin == 281) || (pskin == 282) || (pskin == 283) || (pskin == 284) || (pskin == 285) || (pskin == 286) || (pskin == 287) || (pskin == 288)) {
- return 1;
- }
- return 0;
- }
- public IsArmed(playerid) {
- new arma = GetPlayerWeapon(playerid);
- if ((arma > 18) && (arma < 39)) {
- return 1;
- }
- return 0;
- }
- public CopsConnected() {
- for (new i=0; i<MAX_PLAYERS; i++) {
- if (IsPlayerConnected(i)) {
- if (IsPolice(i) == 1) {
- polcount ++;
- return polcount;
- }
- }
- }
- return 0;
- }
- public RapinaOn() {
- bloccorapina = 0;
- }
- public RapinaTime(playerid) {
- new string[256];
- new polstring[256];
- new pname[MAX_PLAYER_NAME];
- new randbottino = random(randmax-randmin) + randmin;
- GetPlayerName(playerid, pname, sizeof(pname));
- KillTimer(rapinatimer[playerid]);
- israpinatore[playerid] = 0;
- rapinaincorso = 0;
- if (bottinocasuale == 0) {
- format(string, sizeof(string),"Un tizio ha rapinato con successo la banca, e porta a casa ben %d$ !", pname, bottino);
- GivePlayerMoney(playerid, bottino);
- } else {
- format(string, sizeof(string),"Un tizio ha rapinato con successo la banca, e porta a casa ben %d$ !", pname, randbottino);
- GivePlayerMoney(playerid, randbottino);
- }
- SendClientMessageToAll(colore, string);
- for (new i=0; i<MAX_PLAYERS; i++) {
- if (IsPlayerConnected(i)) {
- if (IsPolice(i) == 1) {
- format(polstring, sizeof(polstring),"Hai fallito nell'impedire al rapinatore di fare la rapina!", pname);
- SendClientMessage(i, colore, polstring);
- }
- }
- }
- return 1;
- }
- public BankAreaCheck() {
- for (new i=0; i<MAX_PLAYERS; i++) {
- if (IsPlayerConnected(i)) {
- if (israpinatore[i] == 1) {
- if (IsInBank(i) == 1) {
- } else {
- new polstring[256];
- new rapinatore[MAX_PLAYER_NAME];
- GetPlayerName(i, rapinatore, sizeof(rapinatore));
- israpinatore[i] = 0;
- KillTimer(rapinatimer[i]);
- rapinaincorso = 0;
- SendClientMessage(i, colore, "Sei uscito dalla banca e hai fallito la rapina!");
- for (new pi=0; pi<MAX_PLAYERS; pi++) {
- if (IsPlayerConnected(pi)) {
- if (IsPolice(pi) == 1) {
- format(polstring, sizeof(polstring),"Il tizio uscito dalla banca e ha smesso di rapinare", rapinatore);
- SendClientMessage(pi, colore, polstring);
- }
- }
- }
- }
- }
- }
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnFilterScriptInit() {
- print("\n--FS Rapina By Skiaffo Caricato.\n");
- SetTimer("BankAreaCheck", 500, 1);
- bloccorapina = 0;
- rapinaincorso = 0;
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerConnect(playerid) {
- israpinatore[playerid] = 0; // NON MODIFICARE
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerCommandText(playerid, cmdtext[]) {
- new cmd[256];
- new idx;
- cmd = strtok(cmdtext, idx);
- if (strcmp(cmd, "/rapina", true) == 0) {
- if (IsPolice(playerid) == 0) {
- if (IsInBank(playerid) == 1) {
- if (bloccorapina == 0) {
- if (israpinatore[playerid] == 0) {
- if (CopsConnected() >= copsminimi) {
- if (IsArmed(playerid) == 1) {
- rapinatimer[playerid] = SetTimerEx("RapinaTime", temporapina, 0, "i", playerid);
- israpinatore[playerid] = 1;
- rapinaincorso = 1;
- bloccorapina = 1;
- new string[256];
- new polstring[256];
- new rapstring[256];
- new rapinatore[MAX_PLAYER_NAME];
- GetPlayerName(playerid, rapinatore, sizeof(rapinatore));
- for (new i=0; i<MAX_PLAYERS; i++) {
- if (IsPlayerConnected(i)) {
- if (IsPolice(i) == 1) {
- format(polstring, sizeof(polstring),"Attenzione! qualcuno sta rapinando la banca!", rapinatore);
- SendClientMessage(i, colore, polstring);
- }
- }
- }
- SendClientMessage(playerid, colore, "Hai iniziato la rapina!");
- format(string, sizeof(string),"Resta per almeno %d minuti nella banca per rapinarla con successo!", temporapina/60000);
- SendClientMessage(playerid, colore, string);
- format(rapstring, sizeof(rapstring),"qualcuno ha iniziato a rapinare la banca!", rapinatore);
- SendClientMessageToAll(colore, rapstring);
- } else {
- SendClientMessage(playerid, colore, "Devi avere un'arma da fuoco se vuoi rapinare una banca!");
- }
- } else {
- new minstring[256];
- format(minstring, sizeof(minstring),"Devono esserci minimo %d poliziotti connessi per poter rapinare la banca!", copsminimi);
- SendClientMessage(playerid, colore, minstring);
- }
- } else {
- SendClientMessage(playerid, colore, "Stai gia' rapinando la banca!");
- }
- } else {
- SendClientMessage(playerid, colore, "Al momento non e' possibile rapinare la banca!");
- }
- } else {
- SendClientMessage(playerid, colore, "Non sei in banca!");
- }
- } else {
- SendClientMessage(playerid, colore, "Sei un poliziotto, non puoi rapinare!");
- }
- return 1;
- }
- if (strcmp(cmd, "/copsminimi", true) == 0) {
- if (IsPlayerAdmin(playerid) == 1) {
- if (rapinaincorso == 0) {
- new tmpmincops;
- new tmp[256];
- new string[256];
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- format(string, sizeof(string), "Il numero minimo di poliziotti per fare una rapina e' di %d, scrivi /copsminimi [numero] per cambiarli", copsminimi);
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- tmpmincops = strval(tmp);
- copsminimi = tmpmincops;
- format(string, sizeof(string), "Impostato %d come numero minimo di poliziotti per fare una rapina", copsminimi);
- SendClientMessage(playerid, colore, string);
- } else {
- SendClientMessage(playerid, colore, "C'e' una rapina in corso in questo momento, aspetta che finisca");
- }
- } else {
- SendClientMessage(playerid, colore, "Devi essere admin rcon per utilizzare questo comando");
- }
- return 1;
- }
- if (strcmp(cmd, "/bottino", true) == 0) {
- if (IsPlayerAdmin(playerid) == 1) {
- if (rapinaincorso == 0) {
- if (bottinocasuale == 0) {
- new tmpbottino;
- new tmp[256];
- new string[256];
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- format(string, sizeof(string), "Il bottino attuale e' di %d$, scrivi /bottino [soldi] per cambiarlo", bottino);
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- tmpbottino = strval(tmp);
- bottino = tmpbottino;
- format(string, sizeof(string), "Bottino della rapina impostato a %d$", bottino);
- SendClientMessage(playerid, colore, string);
- } else {
- SendClientMessage(playerid, colore, "E' attivo il bottino casuale. Per disattivarlo usare /bottinocasuale");
- }
- } else {
- SendClientMessage(playerid, colore, "C'e' una rapina in corso in questo momento, aspetta che finisca");
- }
- } else {
- SendClientMessage(playerid, colore, "Devi essere admin rcon per utilizzare questo comando");
- }
- return 1;
- }
- if (strcmp(cmd, "/temporapina", true) == 0) {
- if (IsPlayerAdmin(playerid) == 1) {
- if (rapinaincorso == 0) {
- new tmprapina;
- new tmp[256];
- new string[256];
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- format(string, sizeof(string), "Il tempo di rapina attuale e' di %d minuti, scrivi /temporapina [minuti] per cambiarlo", temporapina/60000);
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- tmprapina = strval(tmp) * 60000;
- temporapina = tmprapina;
- format(string, sizeof(string), "Tempo della rapina impostato a %d minuti", temporapina/60000);
- SendClientMessage(playerid, colore, string);
- } else {
- SendClientMessage(playerid, colore, "C'? una rapina in corso in questo momento, aspetta che finisca");
- }
- } else {
- SendClientMessage(playerid, colore, "Devi essere admin rcon per utilizzare questo comando");
- }
- return 1;
- }
- if (strcmp(cmd, "/randmax", true) == 0) {
- if (IsPlayerAdmin(playerid) == 1) {
- if (rapinaincorso == 0) {
- new tmprand;
- new tmp[256];
- new string[256];
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- format(string, sizeof(string), "L'attuale valore massimo per il bottino random e' %d$", randmax);
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- tmprand = strval(tmp);
- if (tmprand > randmin) {
- randmax = tmprand;
- format(string, sizeof(string), "Valore massimo per il bottino random impostato a %d", randmax);
- SendClientMessage(playerid, colore, string);
- } else {
- SendClientMessage(playerid, colore, "randmax deve essere maggiore di randmin");
- }
- } else {
- SendClientMessage(playerid, colore, "C'e' una rapina in corso in questo momento, aspetta che finisca");
- }
- } else {
- SendClientMessage(playerid, colore, "Devi essere admin rcon per utilizzare questo comando");
- }
- return 1;
- }
- if (strcmp(cmd, "/randmin", true) == 0) {
- if (IsPlayerAdmin(playerid) == 1) {
- if (rapinaincorso == 0) {
- new tmprand;
- new tmp[256];
- new string[256];
- tmp = strtok(cmdtext, idx);
- if (!strlen(tmp)) {
- format(string, sizeof(string), "L'attuale valore minimo per il bottino random e' %d$", randmin);
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- tmprand = strval(tmp);
- if (tmprand < randmax) {
- randmin = tmprand;
- format(string, sizeof(string), "Valore minimo per il bottino random impostato a %d", randmin);
- SendClientMessage(playerid, colore, string);
- } else {
- SendClientMessage(playerid, colore, "randmin deve essere minore di randmax");
- }
- } else {
- SendClientMessage(playerid, colore, "C'e' una rapina in corso in questo momento, aspetta che finisca");
- }
- } else {
- SendClientMessage(playerid, colore, "Devi essere admin rcon per utilizzare questo comando");
- }
- return 1;
- }
- if (strcmp(cmd, "/bottinocasuale", true) == 0) {
- if (IsPlayerAdmin(playerid) == 1) {
- if (rapinaincorso == 0) {
- if (bottinocasuale == 0) {
- SendClientMessage(playerid, colore, "Bottino casuale attivato");
- bottinocasuale = 1;
- } else {
- SendClientMessage(playerid, colore, "Bottino casuale disattivato");
- bottinocasuale = 0;
- }
- } else {
- SendClientMessage(playerid, colore, "C'e' una rapina in corso in questo momento, aspetta che finisca");
- }
- } else {
- SendClientMessage(playerid, colore, "Devi essere admin rcon per utilizzare questo comando");
- }
- return 1;
- }
- // Debug
- /*
- if (strcmp(cmd, "/randbottino", true) == 0) {
- new string[128];
- new randbottino = random(randmax-randmin) + randmin;
- format(string, sizeof(string), "Bottino casuale: %d$", randbottino);
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- if (strcmp(cmd, "/polcount", true) == 0) {
- new string[256];
- format(string, sizeof(string), "Numero poliziotti: %d", CopsConnected());
- SendClientMessage(playerid, colore, string);
- return 1;
- }
- if (strcmp(cmd, "/isinbank", true) == 0) {
- if (IsInBank(playerid) == 1) {
- SendClientMessage(playerid, colore, "si");
- } else {
- SendClientMessage(playerid, colore, "no");
- }
- return 1;
- }
- if (strcmp(cmd, "/ispolice", true) == 0) {
- if (IsPolice(playerid) == 1) {
- SendClientMessage(playerid, colore, "si");
- } else {
- SendClientMessage(playerid, colore, "no");
- }
- return 1;
- }
- */
- return 0;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerDeath(playerid, killerid, reason) {
- if (israpinatore[playerid] == 1) {
- if (killerid == INVALID_PLAYER_ID) {
- SendClientMessage(playerid, colore, "Ti sei ucciso durante una rapina e hai fallito!");
- } else {
- if (IsPolice(killerid) == 1) {
- SendClientMessage(playerid, colore, "Sei stato ucciso da un poliziotto mentre facevi una rapina!");
- } else
- if (israpinatore[killerid] == 1) {
- SendClientMessage(playerid, colore, "Sei stato ucciso da un'altro rapinatore!");
- } else {
- SendClientMessage(playerid, colore, "Sei stato ucciso mentre facevi una rapina!");
- }
- }
- israpinatore[playerid] = 0;
- KillTimer(rapinatimer[playerid]);
- rapinaincorso = 0;
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- //----------------------------------------------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement