20.05.2017, 09:59
Код:
new Iterator:Var_Seeker<MAX_PLAYERS>, Iterator:HNS_Rank<MAX_PLAYERS> ; new HNS_Started; new HNS_Count; new HNS_StartedEx; function StartSeek( playerid ) { if ( HNS_Count == 0 ) { foreach(new i: HNS_Rank) { if ( GetPVarInt( i, "Hidden" ) != 1 && Iter_Contains(Var_Seeker, i) == 0 ) { new next ; Iter_SafeRemove(HNS_Rank, i, next); ResetPlayerWeapons( i ); LoadPlayerCoords(i); SendClientMessage( i, -1, "INFO: "WHITE"You are removed from the \"{FF0000}/hns"WHITE"\". Reason: {FF0000}Need to use /hideme !" ); DeletePVar( i, "Hidden" ); i = next; } } if(Iter_Count(HNS_Rank) > 1) { HNS_Started = 0; HNS_StartedEx = 1; SetTimer( "SeekTime", 300000, 0 ); foreach(new i: Var_Seeker) { if(Iter_Contains(Var_Seeker, i)) { TogglePlayerControllable( i, true ); TD_MSG( i, 3000, "~g~~h~Find all hidders !!!" ); } } } else { foreach(new i: HNS_Rank) { if(Iter_Contains(HNS_Rank, i)) { Iter_Clear(HNS_Rank); Iter_Clear(Var_Seeker); PlayerInfo[ playerid ][ inMini ] = 0; PlayerInfo[ playerid ][ ActionID ] = 0; ResetPlayerWeapons( i ); LoadPlayerCoords(i); SendClientMessage( i, 0xFFFF00FF, "Minigame canceled! Minium are 2 players to can start!" ); TogglePlayerControllable( i, true ); } } HNS_Started = 0; HNS_StartedEx = 0; Iter_Clear(HNS_Rank); Iter_Clear(Var_Seeker); } } else { new gsString [ 3 ]; SetTimerEx( "StartSeek", 1000, 0, "i", playerid ); gsString[ 0 ] = EOS; HNS_Count--; format( gsString, 144, "~w~Starting in ~r~~h~%d~n~~w~seconds", HNS_Count ); TD_MSG( playerid, 3000, gsString ); return ( 1 ); } return ( 1 ); } function SeekTime( ) { if(Iter_Count(HNS_Rank) > 3) { foreach(new i: HNS_Rank) { if (Iter_Contains(HNS_Rank, i)) { ResetPlayerWeapons( i ); LoadPlayerCoords(i); TogglePlayerControllable( i, true ); SendClientMessage( i, 0x33AA33FF, "Hidders won!" ); } } HNS_Started = 0; HNS_StartedEx = 0; Iter_Clear(HNS_Rank); Iter_Clear(Var_Seeker); } return ( 1 ); } CMD:hns( playerid, params[ ] ) { if ( IsPlayerInAnyVehicle( playerid ) ) return TD_MSG( playerid, 3000, "~r~~h~Please exit the vehicle!"); if (Iter_Count(HNS_Rank) > 20) return SendClientMessage(playerid,COLOR_RED,""RED"Hide'N'Seek "WHITE"is full!"); if ( HNS_StartedEx == 1 ) return SendClientMessage(playerid,COLOR_RED,""RED"Hide'N'Seek "WHITE"has started!"); PlayerInfo[ playerid ][ ActionID ] = 9; if ( HNS_Started == 0 ) { SavePlayerCoords(playerid); PlayerInfo[ playerid ][ inMini ] = 1; Iter_Add(HNS_Rank, playerid); Iter_Add(Var_Seeker, playerid); HNS_Started = 1; HNS_Count = 60; GameTextForAll( "~g~~h~Hide'N'Seek ~w~minigame starting in ~r~60 ~w~seconds! ~g~~h~/hns ~w~to join!", 3000, 4 ); SetTimerEx( "StartSeek", 1000, 0, "i", playerid ); TogglePlayerControllable( playerid, false ); ResetPlayerWeapons(playerid); GivePlayerWeapon( playerid, 38, 99999 ); SetPlayerInterior( playerid, 2 ); SetPlayerPos( playerid, 2567.6086, -1294.1406, 1063.2520 ); SetPlayerFacingAngle( playerid, 6.9141 ); SetCameraBehindPlayer( playerid ); return ( 1 ); } else { SavePlayerCoords(playerid); Iter_Add(HNS_Rank, playerid); TD_MSG( playerid, 3000, "~w~Use ~r~~h~/hideme ~w~when you're hidden!" ); ResetPlayerWeapons( playerid ); SetPlayerInterior( playerid, 2 ); SetPlayerPos( playerid, 2559.0579, -1297.1764, 1060.9844 ); SetPlayerFacingAngle( playerid, 263.8967 ); } new string3[128]; format(string3,sizeof string3,"~R~[MG] - ~w~%s ~W~has teleported to(/HNS)!",GetName( playerid )); SendBoxMsg(string3); return 1; }