Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- --* *
- --* @Author: Hanger *
- --* @Version: 1.2 *
- --* *
- */
- #if defined _asp_included
- #endinput
- #endif
- #define _asp_included
- new
- bool: PLAYER_SPAWNED [MAX_PLAYERS],
- SPAWN_TIME [MAX_PLAYERS];
- /* Spawn protection time in seconds */
- #define ANTI_SPAWN_KILL_TIME 10
- /* Maximum serverside health - in case you have 99.9 anticheat */
- #define MAX_HEALTH 100.00
- /* Health to set when player spawns if falling from a high place, player will be killed regardless of this amount */
- #define SPAWN_HEALTH 999.99
- public OnPlayerSpawn(playerid)
- {
- PLAYER_SPAWNED [playerid] = true;
- SPAWN_TIME [playerid] = gettime();
- #if defined asp_OnPlayerSpawn
- return asp_OnPlayerSpawn(playerid);
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnPlayerSpawn
- #undef OnPlayerSpawn
- #else
- #define _ALS_OnPlayerSpawn
- #endif
- #define OnPlayerSpawn asp_OnPlayerSpawn
- #if defined asp_OnPlayerSpawn
- forward asp_OnPlayerSpawn(playerid);
- #endif
- public OnPlayerDeath(playerid, killerid, reason)
- {
- PLAYER_SPAWNED [playerid] = false;
- SPAWN_TIME [playerid] = 0;
- SetPlayerHealth(playerid, SPAWN_HEALTH);
- #if defined asp_OnPlayerDeath
- return asp_OnPlayerDeath(playerid, killerid, reason);
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnPlayerDeath
- #undef OnPlayerDeath
- #else
- #define _ALS_OnPlayerDeath
- #endif
- #define OnPlayerDeath asp_OnPlayerDeath
- #if defined asp_OnPlayerDeath
- forward asp_OnPlayerDeath(playerid, killerid, reason);
- #endif
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
- {
- if(PLAYER_SPAWNED[playerid])
- {
- new
- currenttime = gettime();
- currenttime = (currenttime - SPAWN_TIME[playerid]);
- if(currenttime < ANTI_SPAWN_KILL_TIME)
- {
- SetPlayerHealth(playerid, SPAWN_HEALTH);
- }
- else
- {
- new
- Float: Health;
- GetPlayerHealth(playerid, Health);
- if(Health > MAX_HEALTH)
- {
- SetPlayerHealth(playerid, floatsub(MAX_HEALTH, amount));
- }
- }
- }
- #if defined asp_OnPlayerTakeDamage
- return asp_OnPlayerTakeDamage(playerid, issuerid, amount, weaponid, bodypart);
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnPlayerTakeDamage
- #undef OnPlayerTakeDamage
- #else
- #define _ALS_OnPlayerTakeDamage
- #endif
- #define OnPlayerTakeDamage asp_OnPlayerTakeDamage
- #if defined asp_OnPlayerTakeDamage
- forward asp_OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart);
- #endif
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- if(hittype == BULLET_HIT_TYPE_PLAYER)
- {
- if(PLAYER_SPAWNED[hitid])
- {
- new
- currenttime = gettime();
- currenttime = (currenttime - SPAWN_TIME[hitid]);
- if(currenttime < ANTI_SPAWN_KILL_TIME)
- {
- return 0;
- }
- }
- }
- #if defined asp_OnPlayerWeaponShot
- return asp_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, fX, fY, fZ);
- #else
- return 1;
- #endif
- }
- #if defined _ALS_OnPlayerWeaponShot
- #undef OnPlayerWeaponShot
- #else
- #define _ALS_OnPlayerWeaponShot
- #endif
- #define OnPlayerWeaponShot asp_OnPlayerWeaponShot
- #if defined asp_OnPlayerWeaponShot
- forward asp_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement