Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <streamer>
- #include <zcmd>
- #define MAXIMAL_PLAYERS 500
- #define MAXIMAL_CH 50
- #define FOLDER_CH "Ch"
- #define COLOR_RED 0xFF0000FF
- #define COLOR_GREEN 0x00FF00FF
- #define COLOR_AQUA 0x00FFFFFF
- new GlobalFunctionsTimer;
- new ChUpdateTimer;
- new ChStart;
- new ChTakes;
- new ChSaved;
- new ChPlaces;
- new ChCountdown;
- new Float:ChHidingPosition[4];
- new Float:ChSeekerPosition[4];
- new Float:ChAreaPosition[4];
- new ChArea;
- new ChSeeker;
- new ChTime;
- new WgTakes;
- new WgSaved;
- new DerbyTakes;
- new DerbySaved;
- new HayTakes;
- new HaySaved;
- new RaceTakes;
- new RaceSaved;
- new ArenaTakes;
- new ArenaSaved;
- new PlayerCh[MAXIMAL_PLAYERS];
- new PlayerWg[MAXIMAL_PLAYERS];
- new PlayerDerby[MAXIMAL_PLAYERS];
- new PlayerHay[MAXIMAL_PLAYERS];
- new PlayerRace[MAXIMAL_PLAYERS];
- new PlayerArena[MAXIMAL_PLAYERS];
- new PlayerMoney[MAXIMAL_PLAYERS];
- new PlayerScore[MAXIMAL_PLAYERS];
- public OnGameModeInit()
- {
- GlobalFunctionsTimer = SetTimer("GlobalFunctions",1000,1);
- ChStart = 0;
- ChTakes = 0;
- ChSaved = 0;
- ChPlaces = 2;
- ChCountdown = 0;
- ChHidingPosition[0] = 0;
- ChHidingPosition[1] = 0;
- ChHidingPosition[2] = 0;
- ChHidingPosition[3] = 0;
- ChSeekerPosition[0] = 0;
- ChSeekerPosition[1] = 0;
- ChSeekerPosition[2] = 0;
- ChSeekerPosition[3] = 0;
- ChAreaPosition[0] = 0;
- ChAreaPosition[1] = 0;
- ChAreaPosition[2] = 0;
- ChAreaPosition[3] = 0;
- ChSeeker = 0;
- ChTime = 0;
- WgTakes = 0;
- WgSaved = 0;
- DerbyTakes = 0;
- DerbySaved = 0;
- HayTakes = 0;
- HaySaved = 0;
- RaceTakes = 0;
- RaceSaved = 0;
- ArenaTakes = 0;
- ArenaSaved = 0;
- return 1;
- }
- public OnGameModeExit()
- {
- KillTimer(GlobalFunctionsTimer);
- KillTimer(ChUpdateTimer);
- DestroyDynamicArea(ChArea);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerCh[playerid] = 0;
- PlayerWg[playerid] = 0;
- PlayerDerby[playerid] = 0;
- PlayerHay[playerid] = 0;
- PlayerRace[playerid] = 0;
- PlayerArena[playerid] = 0;
- PlayerMoney[playerid] = 0;
- PlayerScore[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- if(ChStart == 1) ChSaved -= 1;
- if(ChTakes == 1)
- {
- ChSaved -= 1;
- if(ChSaved == 1 && IsPlayerConnected(ChSeeker))
- {
- SendClientMessageToAll(COLOR_AQUA,">>> Zabawa w chowanego została zakończona, szukający wygrał 20000 pieniędzy i 20 punktów.");
- KillTimer(ChUpdateTimer);
- ChStart = 0;
- ChTakes = 0;
- ChSaved = 0;
- ChPlaces = 2;
- ChCountdown = 0;
- ChHidingPosition[0] = 0;
- ChHidingPosition[1] = 0;
- ChHidingPosition[2] = 0;
- ChHidingPosition[3] = 0;
- ChSeekerPosition[0] = 0;
- ChSeekerPosition[1] = 0;
- ChSeekerPosition[2] = 0;
- ChSeekerPosition[3] = 0;
- ChAreaPosition[0] = 0;
- ChAreaPosition[1] = 0;
- ChAreaPosition[2] = 0;
- ChAreaPosition[3] = 0;
- DestroyDynamicArea(ChArea);
- ChSeeker = 0;
- ChTime = 0;
- for(new I = 0; I < MAXIMAL_PLAYERS; I++)
- {
- if(IsPlayerConnected(I) && PlayerCh[I] == 1)
- {
- PlayerCh[I] = 0;
- if(I == ChSeeker)
- {
- PlayerMoney[I] += 20000;
- PlayerScore[I] += 20;
- }
- SetPlayerInterior(I,0);
- SetPlayerVirtualWorld(I,0);
- SpawnPlayer(I);
- }
- }
- }
- if(ChSeeker == playerid)
- {
- SendClientMessageToAll(COLOR_AQUA,">>> Zabawa w chowanego została zakończona, szukający opuścił serwer, chowający się wygrywają 20000 pieniędzy i 20 punktów.");
- KillTimer(ChUpdateTimer);
- ChStart = 0;
- ChTakes = 0;
- ChSaved = 0;
- ChPlaces = 2;
- ChCountdown = 0;
- ChHidingPosition[0] = 0;
- ChHidingPosition[1] = 0;
- ChHidingPosition[2] = 0;
- ChHidingPosition[3] = 0;
- ChSeekerPosition[0] = 0;
- ChSeekerPosition[1] = 0;
- ChSeekerPosition[2] = 0;
- ChSeekerPosition[3] = 0;
- ChAreaPosition[0] = 0;
- ChAreaPosition[1] = 0;
- ChAreaPosition[2] = 0;
- ChAreaPosition[3] = 0;
- DestroyDynamicArea(ChArea);
- ChSeeker = 0;
- ChTime = 0;
- for(new I = 0; I < MAXIMAL_PLAYERS; I++)
- {
- if(IsPlayerConnected(I) && PlayerCh[I] == 1)
- {
- PlayerCh[I] = 0;
- PlayerMoney[I] += 20000;
- PlayerScore[I] += 20;
- SetPlayerInterior(I,0);
- SetPlayerVirtualWorld(I,0);
- SpawnPlayer(I);
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid,killerid,reason)
- {
- if(ChTakes == 1)
- {
- if(PlayerCh[playerid] == 1)
- {
- ChSaved -= 1;
- if(ChSaved == 1)
- {
- SendClientMessageToAll(COLOR_AQUA,">>> Zabawa w chowanego została zakończona, szukający wygrał 20000 pieniędzy i 20 punktów.");
- KillTimer(ChUpdateTimer);
- ChStart = 0;
- ChTakes = 0;
- ChSaved = 0;
- ChPlaces = 2;
- ChCountdown = 0;
- ChHidingPosition[0] = 0;
- ChHidingPosition[1] = 0;
- ChHidingPosition[2] = 0;
- ChHidingPosition[3] = 0;
- ChSeekerPosition[0] = 0;
- ChSeekerPosition[1] = 0;
- ChSeekerPosition[2] = 0;
- ChSeekerPosition[3] = 0;
- ChAreaPosition[0] = 0;
- ChAreaPosition[1] = 0;
- ChAreaPosition[2] = 0;
- ChAreaPosition[3] = 0;
- DestroyDynamicArea(ChArea);
- ChTime = 0;
- for(new I = 0; I < MAXIMAL_PLAYERS; I++)
- {
- if(IsPlayerConnected(I) && PlayerCh[I] == 1)
- {
- PlayerCh[I] = 0;
- if(I == ChSeeker)
- {
- PlayerMoney[I] += 20000;
- PlayerScore[I] += 20;
- }
- SetPlayerInterior(I,0);
- SetPlayerVirtualWorld(I,0);
- SpawnPlayer(I);
- }
- }
- ChSeeker = 0;
- }
- }
- }
- return 1;
- }
- forward GlobalFunctions();
- public GlobalFunctions()
- {
- if(ChStart == 0 && ChTakes == 0 && ChSaved == 2)
- {
- SendClientMessageToAll(COLOR_AQUA,">>> Zabawa w chwoanego wystartuje za 30 sekund, wpisz /Ch aby się zapisać.");
- ChUpdateTimer = SetTimer("ChUpdate",1000,1);
- ChPlaces = 10;
- ChCountdown = 30;
- }
- return 1;
- }
- forward ChUpdate();
- public ChUpdate()
- {
- new String[150];
- if(ChStart == 1)
- {
- ChCountdown -= 1;
- if(ChCountdown == 0)
- {
- if(ChSaved < 2)
- {
- SendClientMessageToAll(COLOR_RED,">>> Zabawa w chowanego nie wystartowała, zapisało się za mało osób.");
- KillTimer(ChUpdateTimer);
- ChStart = 0;
- ChTakes = 0;
- ChSaved = 0;
- ChPlaces = 2;
- ChCountdown = 0;
- ChHidingPosition[0] = 0;
- ChHidingPosition[1] = 0;
- ChHidingPosition[2] = 0;
- ChHidingPosition[3] = 0;
- ChSeekerPosition[0] = 0;
- ChSeekerPosition[1] = 0;
- ChSeekerPosition[2] = 0;
- ChSeekerPosition[3] = 0;
- ChAreaPosition[0] = 0;
- ChAreaPosition[1] = 0;
- ChAreaPosition[2] = 0;
- ChAreaPosition[3] = 0;
- ChSeeker = 0;
- ChTime = 0;
- for(new I = 0; I < MAXIMAL_PLAYERS; I++)
- {
- if(IsPlayerConnected(I) && PlayerCh[I] == 1) PlayerCh[I] = 0;
- }
- }
- if(ChSaved >= 2)
- {
- SendClientMessageToAll(COLOR_AQUA,">>> Zabawa w chowanego wystartowała.");
- ChStart = 0;
- ChTakes = 1;
- format(String,150,"%s/%d.ini",FOLDER_CH,random(MAXIMAL_CH));
- new File:File = fopen(String,io_read);
- fread(File,String);
- sscanf(String,"ffffffffffff",ChHidingPosition[0],ChHidingPosition[1],ChHidingPosition[2],ChHidingPosition[3],ChSeekerPosition[0],ChSeekerPosition[1],ChSeekerPosition[2],ChSeekerPosition[3],ChAreaPosition[0],ChAreaPosition[1],ChAreaPosition[2],ChAreaPosition[3]);
- fclose(File);
- for(new I = 0; I < MAXIMAL_PLAYERS; I++)
- {
- if(IsPlayerConnected(I) && PlayerCh[I] == 1)
- {
- SetPlayerInterior(I,0);
- SetPlayerVirtualWorld(I,1);
- SetPlayerPos(I,ChHidingPosition[0],ChHidingPosition[1],ChHidingPosition[2]);
- SetPlayerFacingAngle(I,ChHidingPosition[3]);
- ChSeeker = random(I);
- SetPlayerPos(ChSeeker,ChSeekerPosition[0],ChSeekerPosition[1],ChSeekerPosition[2]);
- SetPlayerFacingAngle(ChSeeker,ChSeekerPosition[3]);
- SetPlayerHealth(ChSeeker,100000);
- GivePlayerWeapon(ChSeeker,38,100000);
- ChArea = CreateDynamicRectangle(ChAreaPosition[0],ChAreaPosition[1],ChAreaPosition[2],ChAreaPosition[3]);
- }
- }
- }
- }
- }
- if(ChTakes == 1)
- {
- ChTime -= 1;
- if(ChTime == 0)
- {
- SendClientMessageToAll(COLOR_AQUA,">>> Zabawa w chowanego została zakończona, wygrali chowający się, 20000 pieniędzy i 20 punktów.");
- KillTimer(ChUpdateTimer);
- ChStart = 0;
- ChTakes = 0;
- ChSaved = 0;
- ChPlaces = 2;
- ChCountdown = 0;
- ChHidingPosition[0] = 0;
- ChHidingPosition[1] = 0;
- ChHidingPosition[2] = 0;
- ChHidingPosition[3] = 0;
- ChSeekerPosition[0] = 0;
- ChSeekerPosition[1] = 0;
- ChSeekerPosition[2] = 0;
- ChSeekerPosition[3] = 0;
- ChAreaPosition[0] = 0;
- ChAreaPosition[1] = 0;
- ChAreaPosition[2] = 0;
- ChAreaPosition[3] = 0;
- ChTime = 0;
- for(new I = 0; I < MAXIMAL_PLAYERS; I++)
- {
- if(IsPlayerConnected(I) && PlayerCh[I] == 1)
- {
- PlayerCh[I] = 0;
- SetPlayerInterior(I,0);
- SetPlayerVirtualWorld(I,0);
- SpawnPlayer(I);
- if(I != ChSeeker)
- {
- PlayerMoney[I] += 20000;
- PlayerScore[I] += 20;
- }
- }
- }
- ChSeeker = 0;
- }
- }
- return 1;
- }
- COMMAND:ch(playerid,params[])
- {
- if(PlayerCh[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na zabawę w chowanego.");
- if(PlayerWg[playerid] == 1 || PlayerDerby[playerid] == 1 || PlayerHay[playerid] == 1 || PlayerRace[playerid] == 1 || PlayerArena[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na inną zabawę.");
- if(ChTakes == 1) return SendClientMessage(playerid,COLOR_RED,">>> Zabawa w chowanego już trwa.");
- if(ChSaved == ChPlaces) return SendClientMessage(playerid,COLOR_RED,">>> Na zabawę w chowanego nie ma miejsc.");
- SendClientMessage(playerid,COLOR_GREEN,">>> Zapisałeś się na zabawę w chowanego.");
- ChSaved += 1;
- PlayerCh[playerid] = 1;
- return 1;
- }
- COMMAND:wg(playerid,params[])
- {
- if(PlayerWg[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na zabawę w wojnę gangów.");
- if(PlayerCh[playerid] == 1 || PlayerDerby[playerid] == 1 || PlayerHay[playerid] == 1 || PlayerRace[playerid] == 1 || PlayerArena[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na inną zabawę.");
- if(WgTakes == 1) return SendClientMessage(playerid,COLOR_RED,">>> Zabawa w wojnę gangów już trwa.");
- SendClientMessage(playerid,COLOR_GREEN,">>> Zapisałeś się na zabawę w wojnę gangów.");
- WgSaved += 1;
- PlayerWg[playerid] = 1;
- return 1;
- }
- COMMAND:derby(playerid,params[])
- {
- if(PlayerDerby[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na zabawę w derby.");
- if(PlayerCh[playerid] == 1 || PlayerWg[playerid] == 1 || PlayerHay[playerid] == 1 || PlayerRace[playerid] == 1 || PlayerArena[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na inną zabawę.");
- if(DerbyTakes == 1) return SendClientMessage(playerid,COLOR_RED,">>> Zabawa w derby już trwa.");
- SendClientMessage(playerid,COLOR_GREEN,">>> Zapisałeś się na zabawę w derby.");
- DerbySaved += 1;
- PlayerDerby[playerid] = 1;
- return 1;
- }
- COMMAND:hay(playerid,params[])
- {
- if(PlayerHay[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na zabawę w hay.");
- if(PlayerCh[playerid] == 1 || PlayerWg[playerid] == 1 || PlayerDerby[playerid] == 1 || PlayerRace[playerid] == 1 || PlayerArena[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na inną zabawę.");
- if(HayTakes == 1) return SendClientMessage(playerid,COLOR_RED,">>> Zabawa w hay już trwa.");
- SendClientMessage(playerid,COLOR_GREEN,">>> Zapisałeś się na zabawę w hay.");
- HaySaved += 1;
- PlayerHay[playerid] = 1;
- return 1;
- }
- COMMAND:race(playerid,params[])
- {
- if(PlayerRace[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na zabawę w wyścig.");
- if(PlayerCh[playerid] == 1 || PlayerWg[playerid] == 1 || PlayerDerby[playerid] == 1 || PlayerHay[playerid] == 1 || PlayerArena[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na inną zabawę.");
- if(RaceTakes == 1) return SendClientMessage(playerid,COLOR_RED,">>> Zabawa w wyścig już trwa.");
- SendClientMessage(playerid,COLOR_GREEN,">>> Zapisałeś się na zabawę w wyścig.");
- RaceSaved += 1;
- PlayerRace[playerid] = 1;
- return 1;
- }
- COMMAND:arena(playerid,params[])
- {
- if(PlayerArena[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na zabawę w arenę.");
- if(PlayerCh[playerid] == 1 || PlayerWg[playerid] == 1 || PlayerDerby[playerid] == 1 || PlayerHay[playerid] == 1 || PlayerRace[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,">>> Jesteś już zapisany na inną zabawę.");
- if(ArenaTakes == 1) return SendClientMessage(playerid,COLOR_RED,">>> Zabawa w arenę już trwa.");
- SendClientMessage(playerid,COLOR_GREEN,">>> Zapisałeś się na zabawę w arenę.");
- ArenaSaved += 1;
- PlayerArena[playerid] = 1;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment