AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Health + Armor Plugin (https://forums.alliedmods.net/showthread.php?t=159168)

no1kn0wz 06-13-2011 14:29

Health + Armor Plugin
 
Hi there,
I'm planning to make a plugin to get like 40+ hp and armor (in counter-strike 1.6) - after get one kill - and for example - if you kill some1 and you have 70hp - +40, then you'll have 110hp (it can be over 100) - but i want it with a maximun of 220hp and 150armor..i tried to code this using the code posted on this thread, but didn't get luck:

https://forums.alliedmods.net/showthread.php?t=67284

This is my current code:
Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

// Health limit
#define LIMIT 99999999

public plugin_init()
{
    register_plugin("HP + AP After Kill -", "0.1", "Mxx");
    register_event("DeathMsg", "event_DeathMsg", "a");
}

public event_DeathMsg()
{
    static killer, victim;
    killer = read_data(1);
    victim = read_data(2);
    if(!is_user_connected(killer) || !is_user_connected(victim) || !is_user_alive(killer))
        return;
   
    cs_set_user_armor(killer, min(LIMIT, get_user_armor(killer) +20), CS_ARMOR_VESTHELM);
    set_user_health(killer, min(LIMIT, get_user_health(killer) + 40));
}

All i need now is set the maximun HP to 220 and armor to 100 - any ideas?

I'll be really thankful if i get this working - thanks beforehand! :)

Erox902 06-13-2011 16:17

Re: Health + Armor Plugin
 
Code:
#include <amxmodx> #include <cstrike> #include <fun> // Health limit #define LIMIT 220 #define LIMIT2 150 public plugin_init() {     register_plugin("HP + AP After Kill -", "0.1", "Mxx");     register_event("DeathMsg", "event_DeathMsg", "a"); } public event_DeathMsg() {     static killer, victim;     killer = read_data(1);     victim = read_data(2);     if(!is_user_connected(killer) || !is_user_connected(victim) || !is_user_alive(killer))         return;         cs_set_user_armor(killer, min(LIMIT2, get_user_armor(killer) +40), CS_ARMOR_VESTHELM);     set_user_health(killer, min(LIMIT, get_user_health(killer) + 40)); }
Just like this or did you mean something diffrent? :S


All times are GMT -4. The time now is 23:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.