Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ================================================================================
- Phanto's Script
- ________________________________________________________________________________
- •Script: PNascondino •Scripter: Phanto90
- •Tipo: FS •Dimesione: 15 Kb
- •Righe: 365 •Versione: 1.0v
- ________________________________________________________________________________
- * Descrizione *
- Dato che ho visto che molti volevano un sistema tipo Hide&Seek (Nascondino), in
- un momento di ho deciso di costruire questo semplice mini-game.
- La dinamica è la seguente:
- 1.L'evento viene avviato da un timer a caricamento FS avvenuto.
- 2.I giocatori interessati possono partecipare con il comando /partecipa.
- 3.Una volta raggiunto un numero cospicuo di partecipanti, si digita /pronto.
- (L'evento non inizia se non ci sono almeno 2 partecipanti)
- 4.Quando tutti saranno pronti l'evento inizierà e non sarà più possibile
- parteciparvi.
- 5.Verrà scelto a caso il "carcatore" cui verrà dato un Minigun.
- 6.Da questo momento gli altri giocatori hanno 1 minuto per nasconderci prima
- che il cercatore venga liberato. (Non preoccupatevi, non può vedervi mentre vi
- nascondente).
- 7.Passato il minuto verrà liberato il cercatore che dovrà stanare tutti i
- giocatori nascosti.
- 8.Per rendere più equo il gioco, il cercatore avrà 1 minuto a disposizione per
- ogni giocatore partecipante (escluso lui). Quindi: (numeropartecipanti-1)*1min
- 9.Se dovesse riuscire a trovare tutti i player nascosti allora vincerebbe,
- altrimenti come potete dedurre, perderebbe.
- P.S. I giocatori sono "rinchiusi" in un preciso virtual world con dei limiti
- ben stabiliti. Non pensate dunque che si possa fuggire dal luogo designato.
- P.S.2 State attenti se avete comandi che permettono di teletrasportarsi/cambiare
- virtual world. Comprometterebbe il mini gioco.
- Grazie per aver scelto un prodotto Pawnoscripter!
- http://pawnoscripter.forumfree.it
- Phanto90
- ________________________________________________________________________________
- Nota: Non ho avuto tempo e voglia di controllare perfettamente tutto lo script,
- quindi potrebbero esserci dei Bug che non mi si sono presentati durante il
- testing.Se ne trovate prego di informarmi subito sulla pagina dove avete trovato
- la release dello script.
- Vi preghiamo di non rimuovere i crediti.
- ================================================================================
- */
- #include <a_samp>
- //===============COLORI
- #define ROSSO 0xFF3233FF
- #define BIANCO 0xFFFFFFFF
- #define VERDE 0x00FF00FF
- //=========================FORWARD
- forward AvviaEvento();
- forward TimerNascondino();
- forward LiberaCercatore();
- //==============VARIABILIGIOCATORE
- enum InfoGiocatore{InGioco,Pronto};
- new Giocatore[MAX_PLAYERS][InfoGiocatore];
- //=============VARIABILI
- new stringa[1000],nome[25];
- //=============EVENTONASCONDINO
- enum Stato{Aperto,Partecipanti,Pronti,IdCercatore,Avviato,Tempo};
- new Nascondino[Stato];
- //============TEXT
- new Text:TNascondino;
- //============TIMER
- new IdTimerNascondino;
- new Float:Luogo[][3]={
- {-816.5020,1444.7694,13.7891},
- {-814.5127,1429.0792,13.7891},
- {-800.6746,1427.7249,13.7891},
- {-802.1630,1445.7024,13.7891},
- {-788.8439,1445.3196,13.7891},
- {-786.5835,1427.5447,13.7891},
- {-775.2170,1427.5573,13.7891},
- {-774.8434,1444.6289,13.7931},
- {-810.9301,1436.6632,13.7891},
- {-786.6681,1437.2847,13.7891},
- {-773.8650,1437.9960,13.7891}
- };
- new Verbi[][25]={ //Simpatiche frasi ad effetto per chi viene scoperto :D
- "sterminato",
- "eliminato",
- "spappolato",
- "disintegrato",
- "polverizzato",
- "ridotto a brandelli",
- "ridotto a un colabrodo",
- "crivellato di colpi",
- "vaporizzato",
- "maciullato"
- };
- //===================================================================AVVIAEVENTO
- public AvviaEvento()
- {
- if(Nascondino[Aperto]==1) return 1;
- SendClientMessageToAll(BIANCO,"[EVENTO:] L'evento {C14124}Nascondino{FFFFFF} sta per iniziare. Digita {C14124}/Partecipa{FFFFFF} per partecipare.");
- Nascondino[Aperto]=1;
- return 1;
- }
- //===============================================================TIMERNASCONDINO
- public TimerNascondino()
- {
- if(!Nascondino[Avviato]) return KillTimer(IdTimerNascondino);
- Nascondino[Tempo]--;
- new minuti,secondi;
- minuti=floatround(Nascondino[Tempo]/60);
- secondi=Nascondino[Tempo]-(minuti*60);
- format(stringa,sizeof(stringa)," %02d:%02d",minuti,secondi);
- TextDrawSetString(TNascondino,stringa);
- if(Nascondino[Tempo]==0 && Nascondino[Partecipanti]>1)
- {
- format(stringa,sizeof(stringa),"[EVENTO:] {8CE46C}%s{FFFFFF} Non è riuscito a trovare tutti i giocatori! Ha perso il match!",nome);
- SendClientMessageToAll(BIANCO,stringa);
- ResetPlayerWeapons(Nascondino[IdCercatore]);
- TextDrawHideForPlayer(Nascondino[IdCercatore],TNascondino);
- Nascondino[Avviato]=0;
- Nascondino[Aperto]=0;
- Nascondino[Partecipanti]=0;
- Nascondino[Pronti]=0;
- KillTimer(IdTimerNascondino);
- RiavviaEvento();
- }
- return 1;
- }
- //===============================================================LIBERACERCATORE
- public LiberaCercatore()
- {
- if(!Nascondino[Avviato]) return 0;
- TogglePlayerControllable(Nascondino[IdCercatore],1);
- GetPlayerName(Nascondino[IdCercatore],nome,sizeof(nome));
- format(stringa,sizeof(stringa),"[EVENTO:] {8CE46C}%s{FFFFFF} è stato liberato! Nasconditi prima che ti trovi!",nome);
- MandaMessaggioPartecipanti(BIANCO,stringa);
- return 1;
- }
- //====================================================MANDAMESSAGGIOPARTECIPANTI
- stock MandaMessaggioPartecipanti(colore,Messaggio[])
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i) && Giocatore[i][InGioco])
- SendClientMessage(i,colore,Messaggio);
- }
- }
- //================================================================CHECKFINEGIOCO
- stock CheckFineGioco()
- {
- if(Nascondino[Partecipanti]>1) return 0;
- GetPlayerName(Nascondino[IdCercatore],nome,sizeof(nome));
- format(stringa,sizeof(stringa),"[EVENTO:] {8CE46C}%s{FFFFFF} ha trovato tutti i giocatori! Vince quindi il match! Congratulazioni!",nome);
- SendClientMessageToAll(BIANCO,stringa);
- TextDrawHideForPlayer(Nascondino[IdCercatore],TNascondino);
- ResetPlayerWeapons(Nascondino[IdCercatore]);
- SetPlayerWorldBounds(Nascondino[IdCercatore],6000,-6000,6000,-6000);
- Nascondino[Avviato]=0;
- Nascondino[Aperto]=0;
- Nascondino[Partecipanti]=0;
- Nascondino[Pronti]=0;
- Nascondino[Tempo]=0;
- RiavviaEvento();
- return 1;
- }
- //=================================================================RIAVVIAEVENTO
- stock RiavviaEvento()
- {
- Nascondino[IdCercatore]=-1;
- KillTimer(IdTimerNascondino);
- SetTimer("AvviaEvento",60000*2,false);
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(Giocatore[i][InGioco]==1)
- {
- Giocatore[i][InGioco]=0;
- Giocatore[i][Pronto]=0;
- SetPlayerVirtualWorld(i,0);
- SpawnPlayer(i);
- TextDrawHideForPlayer(i,TNascondino);
- SetPlayerWorldBounds(i,6000,-6000,6000,-6000);
- }
- }
- return 1;
- }
- //============================================================ONFILTERSCRIPTINIT
- public OnFilterScriptInit()
- {
- print("_____________________________________________");
- print("PNascondino by Phanto90 caricato con successo");
- print("_____________________________________________");
- SetTimer("AvviaEvento",60000*2,false);
- TNascondino = TextDrawCreate(502.000000, 123.000000, " 00:00");
- TextDrawBackgroundColor(TNascondino, 255);
- TextDrawFont(TNascondino, 3);
- TextDrawLetterSize(TNascondino, 1.040000, 3.299999);
- TextDrawColor(TNascondino, -1);
- TextDrawSetOutline(TNascondino, 1);
- TextDrawSetProportional(TNascondino, 1);
- TextDrawUseBox(TNascondino, 1);
- TextDrawBoxColor(TNascondino, 505290340);
- TextDrawTextSize(TNascondino, 615.000000, 1.000000);
- Nascondino[IdCercatore]=-1;
- return 1;
- }
- //===============================================================ONPLAYERCONNECT
- public OnPlayerConnect(playerid)
- {
- if(Nascondino[Aperto]==1 && !Nascondino[Avviato])
- SendClientMessage(playerid,BIANCO,"[EVENTO:] L'evento {C14124}Nascondino{FFFFFF} è stato avviato. Digita {C14124}/Partecipa{FFFFFF} per partecipare.");
- return 1;
- }
- //============================================================ONPLAYERDISCONNECT
- public OnPlayerDisconnect(playerid, reason)
- {
- TextDrawHideForPlayer(playerid,TNascondino);
- if(Nascondino[IdCercatore]==playerid)
- {
- GetPlayerName(Nascondino[IdCercatore],nome,sizeof(nome));
- format(stringa,sizeof(stringa),"[EVENTO:] {8CE46C}%s{FFFFFF}(cercatore) è uscito dal server. L'evento si è automaticamente chiuso!",nome);
- SendClientMessageToAll(BIANCO,stringa);
- ResetPlayerWeapons(Nascondino[IdCercatore]);
- Giocatore[Nascondino[IdCercatore]][InGioco]=0;
- Giocatore[Nascondino[IdCercatore]][Pronto]=0;
- Nascondino[Avviato]=0;
- Nascondino[Aperto]=0;
- Nascondino[Partecipanti]=0;
- Nascondino[Pronti]=0;
- RiavviaEvento();
- }
- if(Giocatore[playerid][InGioco])
- {
- if(Giocatore[playerid][Pronto])
- Nascondino[Pronti]--;
- Nascondino[Partecipanti]--;
- Giocatore[playerid][InGioco]=0;
- Giocatore[playerid][Pronto]=0;
- GameTextForPlayer(Nascondino[IdCercatore],"Uno in meno a cui pensare!",1,3000);
- CheckFineGioco();
- }
- return 1;
- }
- //=================================================================ONPLAYERDEATH
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(Nascondino[IdCercatore]==playerid)
- {
- GetPlayerName(Nascondino[IdCercatore],nome,sizeof(nome));
- format(stringa,sizeof(stringa),"[EVENTO:] {8CE46C}%s{FFFFFF}(cercatore) è morto. L'evento si è automaticamente chiuso!",nome);
- SendClientMessageToAll(BIANCO,stringa);
- ResetPlayerWeapons(Nascondino[IdCercatore]);
- Giocatore[Nascondino[IdCercatore]][InGioco]=0;
- Giocatore[Nascondino[IdCercatore]][Pronto]=0;
- Nascondino[Avviato]=0;
- Nascondino[Aperto]=0;
- Nascondino[Partecipanti]=0;
- Nascondino[Pronti]=0;
- RiavviaEvento();
- }
- else if(Nascondino[Avviato]==1 && killerid==Nascondino[IdCercatore] && Giocatore[playerid][InGioco])
- {
- GetPlayerName(playerid,nome,sizeof(nome));
- new verbo=random(sizeof(Verbi));
- format(stringa,sizeof(stringa),"[NASCONDINO:] {8CE46C}%s{FFFFFF} è appena stato %s",nome,Verbi[verbo]);
- MandaMessaggioPartecipanti(BIANCO,stringa);
- GameTextForPlayer(killerid,"Uno in meno a cui pensare!",1,3000);
- Nascondino[Partecipanti]--;
- Giocatore[playerid][InGioco]=0;
- Giocatore[playerid][Pronto]=0;
- TextDrawHideForPlayer(playerid,TNascondino);
- SetPlayerWorldBounds(playerid,6000,-6000,6000,-6000);
- SetPlayerVirtualWorld(playerid,0);
- CheckFineGioco();
- }
- else if(Nascondino[Avviato]==1 && Giocatore[playerid][InGioco]==1)
- {
- GetPlayerName(playerid,nome,sizeof(nome));
- format(stringa,sizeof(stringa),"[NASCONDINO:] {8CE46C}%s{FFFFFF} è morto per cause fortuite.",nome);
- MandaMessaggioPartecipanti(BIANCO,stringa);
- SetPlayerWorldBounds(playerid,6000,-6000,6000,-6000);
- TextDrawHideForPlayer(playerid,TNascondino);
- Nascondino[Partecipanti]--;
- Giocatore[playerid][InGioco]=0;
- Giocatore[playerid][Pronto]=0;
- SetPlayerVirtualWorld(playerid,0);
- CheckFineGioco();
- }
- return 1;
- }
- //===========================================================ONPLAYERCOMMANDTEXT
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- //====================================PARTECIPA
- if(!strcmp("/partecipa",cmdtext,true))
- {
- if(Giocatore[playerid][InGioco]) return SendClientMessage(playerid,ROSSO,"[ERRORE:] {FFFFFF}Stai già partecipando all'evento.");
- if(!Nascondino[Aperto]) return SendClientMessage(playerid,ROSSO,"[ERRORE:] {FFFFFF}L'evento è chiuso per ora. Prova in un secondo momento.");
- if(Nascondino[Avviato]) return SendClientMessage(playerid,ROSSO,"[ERRORE:] {FFFFFF}L'evento è già stato avviato. Attendi il prossimo.");
- new RandomSpawn=random(sizeof(Luogo));
- SetPlayerPos(playerid,Luogo[RandomSpawn][0],Luogo[RandomSpawn][1],Luogo[RandomSpawn][2]);
- SetPlayerVirtualWorld(playerid,501);
- SetPlayerInterior(playerid,0);
- SendClientMessage(playerid,BIANCO,"[EVENTO:] Ora stai partecipanto all'evento. Digita {C14124}Pronto{FFFFFF} quando sei pronto. Devi aspettare fino a quando non saranno tutti pronti.");
- Nascondino[Partecipanti]++;
- Nascondino[Tempo]=(Nascondino[Partecipanti])*60;
- Giocatore[playerid][InGioco]=1;
- SetPlayerHealth(playerid,100);
- SetPlayerWorldBounds(playerid,-739.0712,-916.6221,1629.5925,1416.5366);
- new minuti,secondi;
- minuti=floatround(Nascondino[Tempo]/60);
- secondi=Nascondino[Tempo]-(minuti*60);
- format(stringa,sizeof(stringa)," %02d:%02d",minuti,secondi);
- TextDrawSetString(TNascondino,stringa);
- TextDrawShowForPlayer(playerid,TNascondino);
- SendClientMessage(playerid,BIANCO,"[EVENTO:] Ora stai partecipanto a {C14124}Nascondino{FFFFFF}. Digita {C14124}/Pronto{FFFFFF} quando vuoi iniziare.");
- return 1;
- }
- //===================================PRONTO
- if(!strcmp("/pronto",cmdtext,true))
- {
- if(!Giocatore[playerid][InGioco]) return SendClientMessage(playerid,ROSSO,"[ERRORE:] {FFFFFF}Non stai partecipando all'evento.");
- if(Giocatore[playerid][Pronto]) return SendClientMessage(playerid,ROSSO,"[ERRORE:] {FFFFFF}Sei già pronto.");
- if(Nascondino[Pronti]!=Nascondino[Partecipanti])
- SendClientMessage(playerid,BIANCO,"[STATO:] Ora sei pronto. Attendi che anche gli altri giocatori siano pronti.");
- if(Nascondino[Partecipanti]==1)
- SendClientMessage(playerid,BIANCO,"[STATO:] Ora sei pronto. Servono almeno 2 giocatori per iniziare l'evento.");
- Giocatore[playerid][Pronto]=1;
- Nascondino[Pronti]++;
- if(Nascondino[Pronti]==Nascondino[Partecipanti] && Nascondino[Partecipanti]>1)
- {
- Nascondino[Avviato]=1;
- new i=0;
- while(i==0)
- {
- Nascondino[IdCercatore]=random(MAX_PLAYERS);
- if(IsPlayerConnected(Nascondino[IdCercatore]) && Giocatore[Nascondino[IdCercatore]][InGioco])
- {
- GivePlayerWeapon(Nascondino[IdCercatore],38,10000);
- TogglePlayerControllable(Nascondino[IdCercatore],0);
- i=1;
- }
- }
- for(i=0;i<MAX_PLAYERS;i++)
- {
- if(Giocatore[i][InGioco]==1 && i!=Nascondino[IdCercatore])
- {
- MandaMessaggioPartecipanti(BIANCO,"[EVENTO:] {C14124}Nascondino sta per iniziare! Svelto hai un minuto per nasconderti!");
- ResetPlayerWeapons(i);
- SetPlayerColor(playerid,GetPlayerColor(playerid) & 0xFFFFFF00);
- }
- }
- GetPlayerName(Nascondino[IdCercatore],nome,sizeof(nome));
- SetPlayerHealth(Nascondino[IdCercatore],100000.0);
- format(stringa,sizeof(stringa),"[EVENTO:] {8CE46C}%s{FFFFFF} è stato selezionato per fare il cercatore.",nome);
- MandaMessaggioPartecipanti(BIANCO,stringa);
- IdTimerNascondino=SetTimer("TimerNascondino",1000,true);
- SetTimer("LiberaCercatore",60000,false);
- }
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement