Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock Float:GetWeaponDamage(weaponid) // указываем свой урон от определенного оружия.
- {
- switch(weaponid)
- {
- case WEAPON_BRASSKNUCKLE: return 1.0;
- case WEAPON_GOLFCLUB: return 1.0;
- case WEAPON_NITESTICK: return 1.0;
- case WEAPON_KNIFE: return 1.0;
- case WEAPON_BAT: return 1.0;
- case WEAPON_SHOVEL: return 1.0;
- case WEAPON_POOLSTICK: return 1.0;
- case WEAPON_KATANA: return 1.0;
- case WEAPON_CHAINSAW: return 1.0;
- case WEAPON_DILDO: return 1.0;
- case WEAPON_DILDO2: return 1.0;
- case WEAPON_VIBRATOR: return 1.0;
- case WEAPON_VIBRATOR2: return 1.0;
- case WEAPON_FLOWER: return 1.0;
- case WEAPON_CANE: return 1.0;
- case WEAPON_GRENADE: return 1.0;
- case WEAPON_TEARGAS: return 1.0;
- case WEAPON_MOLTOV: return 1.0;
- case WEAPON_COLT45: return 1.0;
- case WEAPON_SILENCED: return 1.0;
- case WEAPON_DEAGLE: return 1.0;
- case WEAPON_SHOTGUN: return 1.0;
- case WEAPON_SAWEDOFF: return 1.0;
- case WEAPON_SHOTGSPA: return 1.0;
- case WEAPON_UZI: return 1.0;
- case WEAPON_MP5: return 1.0;
- case WEAPON_AK47: return 1.0;
- case WEAPON_M4: return 1.0;
- case WEAPON_TEC9: return 1.0;
- case WEAPON_RIFLE: return 1.0;
- case WEAPON_SNIPER: return 1.0;
- case WEAPON_ROCKETLAUNCHER: return 1.0;
- case WEAPON_HEATSEEKER: return 1.0;
- case WEAPON_FLAMETHROWER: return 1.0;
- case WEAPON_MINIGUN: return 1.0;
- case WEAPON_SATCHEL: return 1.0;
- case WEAPON_SPRAYCAN: return 1.0;
- case WEAPON_FIREEXTINGUISHER: return 1.0;
- default: return 100.0;
- }
- return 0.0;
- }
- static bool:CALLED = false;
- #define UPDATE_DAMAGE_TIME 300 // время в миллисекундах. после нанесения урона через это время установится 255-ая команда.
- #define SLOT_TEAM 1 // если в моде не используется SetPlayerTeam, то значение не менять.
- public OnGameModeInit()
- {
- CALLED = funcidx("damage_OnPlayerGiveDamage") != -1;
- SetTeamCount(MAX_PLAYERS);
- if(funcidx("damage_OnGameModeInit") != -1) return CallLocalFunction("damage_OnGameModeInit", "");
- else return 1;
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit damage_OnGameModeInit
- forward damage_OnGameModeInit();
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
- {
- if(playerid != damagedid && playerid != INVALID_PLAYER_ID)
- {
- SetPlayerTeam(playerid, SLOT_TEAM);
- SetPlayerTeam(damagedid, SLOT_TEAM);
- new Float:health[2];
- GetPlayerHealth(damagedid, health[0]);
- GetPlayerArmour(damagedid, health[1]);
- if(health[1] > 0.0)
- {
- health[1] -= GetWeaponDamage(weaponid);
- if(health[1] < 0.0)
- {
- health[0] -= -health[1];
- health[1] = 0.0;
- }
- }
- else health[0] -= GetWeaponDamage(weaponid);
- SetPlayerHealth(damagedid, health[0]);
- SetPlayerArmour(damagedid, health[1]);
- SetTimerEx("DeleteOldWeaponDamage", UPDATE_DAMAGE_TIME, false, "ii", damagedid, playerid);
- }
- return (CALLED) ? CallLocalFunction("damage_OnPlayerGiveDamage", "iifi", playerid, damagedid, amount, weaponid) : 1;
- }
- #if defined _ALS_OnPlayerGiveDamage
- #undef OnPlayerGiveDamage
- #else
- #define _ALS_OnPlayerGiveDamage
- #endif
- #define OnPlayerGiveDamage damage_OnPlayerGiveDamage
- forward damage_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
- forward DeleteOldWeaponDamage(damagedid, playerid);
- public DeleteOldWeaponDamage(damagedid, playerid)
- {
- SetPlayerTeam(playerid, 255);
- SetPlayerTeam(damagedid, 255);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement