Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DIALOG_MDC 1000
- #define DIALOG_RICERCAPERSONA 1001
- #define DIALOG_RICERCAVEICOLO 1002
- #define DIALOG_FEDINE 1003
- #define DIALOG_INFOPERSONA 1004
- #define DIALOG_INFOVEICOLO 1005
- // Tazer
- new ptazer[MAX_PLAYERS];
- new pammo[MAX_PLAYERS];
- new pweap[MAX_PLAYERS];
- OnPlayerConnect
- // Tazer
- ptazer[playerid] = 0;
- pammo[playerid] = 0;
- pweap[playerid] = 0;
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (newkeys & KEY_FIRE) {
- if(ptazer[playerid] == 1) {
- ClearAnimations(playerid, 0);
- ApplyAnimation(playerid, "COLT45", "colt45_reload", 4.1, 0, 0, 0, 0, 1, 1);
- cmd_pta(playerid, "");
- }
- return 1;
- }
- return 1;
- }
- OnDialogResponse
- // MDC
- if(dialogid == DIALOG_MDC)
- {
- if(!response) return 1;
- if(listitem == 0)
- {
- ShowPlayerDialog(playerid, DIALOG_RICERCAPERSONA, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "Inserisci il nome di un player (anche offline!) per controllare le sue informazioni.\nNOTA: Le multe non vengono visualizzate qui.", "Cerca", "Indietro");
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid, DIALOG_RICERCAVEICOLO, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "Inserisci l'ID di un veicolo per controllare le sue informazioni.", "Cerca", "Indietro");
- }
- if(listitem == 2)
- {
- ShowPlayerDialog(playerid, DIALOG_FEDINE, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "Inserisci il nome di un player (anche offline!) per controllare la sua fedina penale.\nNOTA: Le informazioni generali non vengono visualizzate qui.", "Cerca", "Indietro");
- }
- return 1;
- }
- if(dialogid == DIALOG_RICERCAPERSONA)
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
- new path[256];
- new tizio [256];
- format(tizio, sizeof(tizio), "%s", inputtext);
- format(path, sizeof(path), ACCOUNT, tizio);
- if(!dini_Exists(path)) return ShowPlayerDialog(playerid, DIALOG_RICERCAPERSONA, DIALOG_STYLE_INPUT, "|| Mobile Data Computer:", "ERRORE, il nome digitato non è presente nel Database!\nInserisci il nome di un player (anche offline!) per controllare le sue informazioni.\nNOTA: Le multe non vengono visualizzate qui.", "Cerca", "Indietro");
- format(stringa, sizeof(stringa), " * | Risultati ricerca '%s' | *", inputtext);
- format(stringa1, sizeof(stringa1), "Dati Anagrafici | Nome e Cognome: %s | Età: %d | Recapito Telefonico: %d | N° Civico: 23 Fort Carson", inputtext, dini_Int(path, "Score"), dini_Int(path, "Punti"));
- ShowPlayerDialog(playerid, DIALOG_INFOPERSONA, DIALOG_STYLE_MSGBOX, stringa, stringa1, "Indietro", "");
- return 1;
- }
- if(dialogid == DIALOG_RICERCAVEICOLO)
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
- format(stringa, sizeof(stringa), "Proprietario: %s\nTarga: %s\n e tutte le informazioni possibili", ");
- ShowPlayerDialog(playerid, DIALOG_INFOVEICOLO, DIALOG_STYLE_MSGBOX, "|| Risultati Ricerca Veicolo:", stringa, "Indietro", "");
- return 1;
- }
- if(dialogid == DIALOG_FEDINE)
- {
- if(!response) return ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
- new path[256];
- new tizio[256];
- format(tizio, sizeof(tizio), "%s", inputtext);
- format(path, sizeof(path), FEDINE, tizio);
- format(stringa, sizeof(stringa), " * | Mobile Data Computer, risultati ricerca '%s' | *", inputtext);
- SendClientMessage(playerid, COLORE_ROSSO, stringa);
- if(!dini_Exists(path)) return SendClientMessage(playerid, -1, " * Questa persona ha la fedina penale pulita!");
- ReadFile(playerid, path);
- return 1;
- }
- // Comandi MDC - Pistol Tazer
- // MDC
- CMD:mdc(playerid, params[])
- {
- ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_LIST, "|| Mobile Data Computer:", "Ricerca Persona (tramite Nome)\nRicerca Veicolo (tramite ID)\nFedina Penale (tramite Nome)", "Seleziona", "Annulla");
- return 1;
- }
- CMD:pta(playerid, params[])
- {
- // PREMESSA, se il player ha una 9mm, avrà più munizioni di tale arma
- if(ptazer[playerid] == 0){
- ptazer[playerid] = 1;
- new arma, munizioni;
- new deagle = GetWeaponSlot(24);
- //new 9mm = GetWeaponSlot(23);
- GetPlayerWeaponData(playerid, deagle, arma, munizioni);
- pweap[playerid] = arma;
- pammo[playerid] = munizioni;
- GivePlayerWeapon(playerid, 23, 1);
- SendClientMessage(playerid, COLORE_VERDE, "[INFO]: Hai attivato il pistol-tazer!");
- } else {
- ptazer[playerid] = 0;
- SendClientMessage(playerid, COLORE_VERDE, "[INFO]: Hai disattivato il pistol-tazer!");
- GivePlayerWeapon(playerid, pweap[playerid], pammo[playerid]);
- pweap[playerid] = 0;
- pammo[playerid] = 0;
- }
- return 1;
- }
- // Da aggiungere al comando /multa
- new anno,mese,giorno, ora,minuti,secondi;
- getdate(anno, mese, giorno); gettime(ora, minuti, secondi);
- format(path, sizeof(path), FEDINE, GetName(tizio));
- new File:handle = fopen(path, io_append);
- if(fexist(path)) {
- format(stringa, sizeof(stringa), "[MULTA] (%d/%d/%d ora: %d:%d) %s è stato multato(%d$) da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), ammonto, GetName(playerid), ragione);
- fwrite(handle, stringa);
- fclose(handle);
- } else {
- //fcreate(handle);
- format(stringa, sizeof(stringa), "[MULTA] (%d/%d/%d ora: %d:%d) %s è stato multato(%d$) da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), ammonto, GetName(playerid), ragione);
- fwrite(handle, stringa);
- fclose(handle);
- }
- return 1;
- }
- // Da aggiungere al comando /su (sospetta)
- format(path, sizeof(path), FEDINE, GetName(tizio));
- new File:handle = fopen(path, io_append);
- if(fexist(path)) {
- format(stringa, sizeof(stringa), "[CRIMINE] (%d/%d/%d ora: %d:%d) %s è stato incriminato da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
- fwrite(handle, stringa);
- fclose(handle);
- } else {
- //fcreate(handle);
- format(stringa, sizeof(stringa), "[CRIMINE] (%d/%d/%d ora: %d:%d) %s è stato incriminato da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
- fwrite(handle, stringa);
- fclose(handle);
- }
- // Da aggiungere al comando /arresta, aggiungere se si può il minuto "-1", per ruolare eventuali ergastoli
- format(path, sizeof(path), FEDINE, GetName(tizio));
- new File:handle = fopen(path, io_append);
- if(fexist(path)) {
- format(stringa, sizeof(stringa), "[ARRESTO] (%d/%d/%d ora: %d:%d) %s è stato arrestato da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
- fwrite(handle, stringa);
- fclose(handle);
- } else {
- //fcreate(handle);
- format(stringa, sizeof(stringa), "[ARRESTO] (%d/%d/%d ora: %d:%d) %s è stato arresto da %s, motivo: %s\r\n", giorno, mese, anno, ora, minuti, GetName(tizio), GetName(playerid), ragione);
- fwrite(handle, stringa);
- fclose(handle);
- }
- // Pistol Tazer
- public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
- {
- // Piccolo bug nella mia GM, non so se nella vostra funziona
- new Float:heal;
- GetPlayerHealth(damagedid, heal);
- if(ptazer[playerid] == 0) {}
- if(ptazer[playerid] == 1 && GetPlayerWeapon(playerid) == 23) {
- TogglePlayerControllable(damagedid, 0);
- SendClientMessage(damagedid, COLORE_ROSSO, "[INFO]: Sei stato TAZERATO per 20 secondi!");
- SetTimerEx("tazertimer", 20000, false, "i", damagedid);
- SetPlayerHealth(damagedid, heal+amount);
- }
- return 1;
- }
- // Lettura Logs
- stock ReadFile(playerid, fname[])
- {
- new File:file = fopen(fname, io_read), string[800];
- if(file) {
- while(fread(file, string))
- SendClientMessage(playerid, -1, string);
- fclose(file); }
- }
- // Tazer - Per controllare se un'arma è nello slot di un player, utile per rimpiazzare le munizioni di deagle quando si toglie il tazer
- stock GetWeaponSlot(weaponid)
- {
- new slot;
- switch(weaponid)
- {
- case 0,1: slot = 0;
- case 2 .. 9: slot = 1;
- case 10 .. 15: slot = 10;
- case 16 .. 18, 39: slot = 8;
- case 22 .. 24: slot =2;
- case 25 .. 27: slot = 3;
- case 28, 29, 32: slot = 4;
- case 30, 31: slot = 5;
- case 33, 34: slot = 6;
- case 35 .. 38: slot = 7;
- case 40: slot = 12;
- case 41 .. 43: slot = 9;
- case 44 .. 46: slot = 11;
- }
- return slot;
- }
- forward tazertimer(playerid);
- public tazertimer(playerid)
- {
- TogglePlayerControllable(playerid, 1);
- SendClientMessage(playerid, 0xFFFF00AA, "[INFO]: Non sei più tazerato!");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement