#include #include #include #include public Plugin:myinfo = { name = "Cmod class: Terminator", author = "KochamFootball", description = "std class", version = "0.1", url = "http://amxx.pl" }; new bool:active[MAXPLAYERS+1]; public OnPluginStart() { new Handle:weapons = CreateArray(32); PushArrayString(weapons, "weapon_m4a1"); PushArrayString(weapons, "weapon_ak47"); PushArrayString(weapons, "weapon_knife"); PushArrayString(weapons, "weapon_elite"); PushArrayString(weapons, "weapon_hegrenade"); PushArrayString(weapons, "weapon_smokegrenade"); PushArrayString(weapons, "weapon_flashbang"); PushArrayString(weapons, "weapon_flashbang"); Cmod_RegisterClass("[PREMIUM] Terminator", "Dostaje 10 HP + 1/2 INT za każde zabójstwo!", 40, 50, 60, 5, weapons); HookEvent("player_death", eventPlayerDeath); } public OnClassEnabled(id) { if(!GetAdminFlag(GetUserAdmin(id), Admin_Custom3)){ PrintToChat(id, "x01x0Bx01 x07%s x06Nie możesz używać tej klasy!", MOD_TAG); return CMOD_DISABLE; } active[id] = true; return CMOD_CONTINUE; } public OnClassDisabled(id) { active[id] = false; } public eventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); if(active[attacker]){ if(IsClientInGame(attacker) && IsPlayerAlive(attacker)){ decl medic, health, maxHealth; health = GetEntData(attacker, FindDataMapOffs(attacker, "m_iHealth"), 4); maxHealth = GetEntData(attacker, FindDataMapOffs(attacker, "m_iMaxHealth"), 4); medic = 10 + (Cmod_GetINT(attacker)/2); if(health < maxHealth){ if((health + medic) > maxHealth) medic = maxHealth; else medic += health; SetEntData(attacker, FindDataMapOffs(attacker, "m_iHealth"), medic, 5, true); } } } }