Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * --- iLoops ---
- * Por DanDRT(Danilo Galvão)
- * Agradecimentos: Willian e IpsBruno.
- * [iPs]TeaM
- * mixmusicas.com.br ipsbr.net
- */
- #if defined _iloops_included
- #endinput
- #endif
- #define _iloops_included
- #pragma library iloops
- #include <iEach>
- new Each:Players[MAX_PLAYERS];
- new Each:Spawned[MAX_PLAYERS];
- new Each:VehiclesCreated[MAX_VEHICLES];
- new Each:VehiclesSpawned[MAX_VEHICLES];
- #define ILOOPS_V 1.1
- /*
- * GetPlayersConnected()
- * - Serve para obter o exato de jogadores conectados.
- */
- #define GetPlayersConnected() \
- EachCount(Players)
- /*
- * IsPlayerConnected(playerid)
- * - Serve para verificar se o jogador está conectado.
- */
- #define IsPlayerConnected(%0) \
- (IsActive(Players, %0) || IsPlayerNPC(%0))
- /*
- * IsPlayerSpawned(playerid)
- * - Verifica se o jogador "playerid" está Spawned ou não.
- */
- #define IsPlayerSpawned(%0) \
- IsActive(Spawned, %0)
- /*
- * *
- * Funções para Veiculos *
- * *
- */
- /*
- * IsValidVehicle(vehicleid)
- * - Verifica se o veiculo "vehicleid" foi criado.
- */
- #define IsValidVehicle(%0) \
- IsActive(VehiclesCreated, %0)
- /*
- * IsVehicleSpawned(vehicleid)
- * - Verifica se o veiculo "vehicleid" está Spawned ou não.
- */
- #define IsVehicleSpawned(%0) \
- IsActive(VehiclesSpawned, %0)
- /*
- * GetNumberofCarsCreated()
- * - Obtem o Numero de carros criados.
- */
- #define GetNumberofCarsCreated() \
- EachCount(VehiclesCreated)
- /*
- * GetNumberofCarsSpawned()
- * - Obtem o Numero de carros Spawneds.
- */
- #define GetNumberofCarsSpawned() \
- EachCount(VehiclesSpawned)
- /*
- * *
- * Funções Hookeadas *
- * *
- */
- stock Ips_AddStaticVehicle(modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, color1, color2)
- {
- new vehicleid = AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
- EachAdd(VehiclesCreated, vehicleid);
- return vehicleid;
- }
- #if defined _ALS_AddStaticVehicle
- #undef AddStaticVehicle
- #else
- #define _ALS_AddStaticVehicle
- #endif
- #define AddStaticVehicle Ips_AddStaticVehicle
- stock Ips_CreateVehicle(modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, color1, color2, timespawn)
- {
- new vehicleid = AddStaticVehicleEx(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2, timespawn);
- EachAdd(VehiclesCreated, vehicleid);
- return vehicleid;
- }
- #if defined _ALS_CreateVehicle
- #undef CreateVehicle
- #else
- #define _ALS_CreateVehicle
- #endif
- #define CreateVehicle Ips_CreateVehicle
- stock Ips_AddStaticVehicleEx(modelid, Float: spawn_x, Float: spawn_y, Float: spawn_z, Float: z_angle, color1, color2, timespawn)
- {
- new vehicleid = AddStaticVehicleEx(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2, timespawn);
- EachAdd(VehiclesCreated, vehicleid);
- return vehicleid;
- }
- #if defined _ALS_AddStaticVehicleEx
- #undef AddStaticVehicleEx
- #else
- #define _ALS_AddStaticVehicleEx
- #endif
- #define AddStaticVehicleEx Ips_AddStaticVehicleEx
- stock Ips_DestroyVehicle(vehicleid)
- {
- return EachRemove(VehiclesCreated, vehicleid), DestroyVehicle(vehicleid);
- }
- #if defined _ALS_DestroyVehicle
- #undef DestroyVehicle
- #else
- #define _ALS_DestroyVehicle
- #endif
- #define DestroyVehicle Ips_DestroyVehicle
- /*
- * *
- * OnPlayerConnect *
- * *
- */
- public OnPlayerConnect(playerid)
- {
- if(!IsPlayerNPC(playerid))
- EachAdd(Players, playerid);
- EachRemove(Spawned, playerid);
- #if defined Ips_OnPlayerConnect
- return Ips_OnPlayerConnect(playerid);
- #else
- return true;
- #endif
- }
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnPlayerConnect Ips_OnPlayerConnect
- #if defined Ips_OnPlayerConnect
- forward OnPlayerConnect(playerid);
- #endif
- /*
- * *
- * OnPlayerDisconnect *
- * *
- */
- public OnPlayerDisconnect(playerid, reason)
- {
- if(!IsPlayerNPC(playerid))
- EachRemove(Players, playerid);
- #if defined Ips_OnPlayerDisconnect
- return Ips_OnPlayerDisconnect(playerid, reason);
- #else
- return true;
- #endif
- }
- #if defined _ALS_OnPlayerDisconnect
- #undef OnPlayerDisconnect
- #else
- #define _ALS_OnPlayerDisconnect
- #endif
- #define OnPlayerDisconnect Ips_OnPlayerDisconnect
- #if defined Ips_OnPlayerDisconnect
- forward OnPlayerDisconnect(playerid);
- #endif
- /*
- * *
- * OnPlayerSpawn *
- * *
- */
- public OnPlayerSpawn(playerid)
- {
- if(!IsPlayerNPC(playerid))
- EachAdd(Spawned, playerid);
- #if defined Ips_OnPlayerSpawn
- return Ips_OnPlayerSpawn(playerid);
- #else
- return true;
- #endif
- }
- #if defined _ALS_OnPlayerSpawn
- #undef OnPlayerSpawn
- #else
- #define _ALS_OnPlayerSpawn
- #endif
- #define OnPlayerSpawn Ips_OnPlayerSpawn
- #if defined Ips_OnPlayerSpawn
- forward OnPlayerSpawn(playerid);
- #endif
- /*
- * *
- * OnVehicleSpawn *
- * *
- */
- public OnVehicleSpawn(vehicleid)
- {
- EachAdd(VehiclesSpawned, vehicleid);
- #if defined Ips_OnVehicleSpawn
- return Ips_OnVehicleSpawn(vehicleid);
- #else
- return true;
- #endif
- }
- #if defined _ALS_OnVehicleSpawn
- #undef OnVehicleSpawn
- #else
- #define _ALS_OnVehicleSpawn
- #endif
- #define OnVehicleSpawn Ips_OnVehicleSpawn
- #if defined Ips_OnVehicleSpawn
- forward OnVehicleSpawn(vehicleid);
- #endif
- /*
- * *
- * OnVehicleDeath *
- * *
- */
- public OnVehicleDeath(vehicleid, killerid)
- {
- EachRemove(VehiclesSpawned, vehicleid);
- #if defined Ips_OnVehicleDeath
- return Ips_OnVehicleDeath(vehicleid, killerid);
- #else
- return true;
- #endif
- }
- #if defined _ALS_OnVehicleDeath
- #undef OnVehicleDeath
- #else
- #define _ALS_OnVehicleDeath
- #endif
- #define OnVehicleDeath Ips_OnVehicleDeath
- #if defined Ips_OnVehicleDeath
- forward OnVehicleDeath(vehicleid, killerid);
- #endif
- /*
- * *
- * OnPlayerDeath *
- * *
- */
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(!IsPlayerNPC(playerid))
- EachRemove(Spawned, playerid);
- #if defined Ips_OnPlayerDeath
- return Ips_OnPlayerDeath(playerid, killerid, reason);
- #else
- return true;
- #endif
- }
- #if defined _ALS_OnPlayerDeath
- #undef OnPlayerDeath
- #else
- #define _ALS_OnPlayerDeath
- #endif
- #define OnPlayerDeath Ips_OnPlayerDeath
- #if defined Ips_OnPlayerDeath
- forward OnPlayerDeath(playerid, killerid, reason);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement