Raised This Month: $ Target: $400
 0% 

[req] very simple edit plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
morrow
Member
Join Date: Dec 2008
Old 04-02-2015 , 06:36   [req] very simple edit plugin
Reply With Quote #1

Hey, i need to help with one plugin.
This plugin should give 2 life per headshot and 1 life per kill...
but problem is... when Terro kills CT ..Terro + 1 life for kill..but when CT kills terro he doesnt have life after.. where is problem ? can somebody help me by edit plugin ?
And if possible, want this ...when terro team win, terro have +1 life.. and when ct team win ct team 0 life.

PHP Code:
#include <amxmodx>
#include <colorchat>
#include <hamsandwich>
#include <cstrike>
#include <nvault>
#include <fun>

new Lives[33];

new 
pCvarLifeBuypCvarLifeSell;
new 
pCvarHudsON;

new 
iLifeBuyiLifeSelliHudsON;

new 
Vault;

public 
plugin_cfg()
{
    
iLifeBuy get_pcvar_num(pCvarLifeBuy);
    
iLifeSell get_pcvar_num(pCvarLifeSell);
    
iHudsON get_pcvar_num(pCvarHudsON);
}
public 
plugin_init()
{
    new const 
PLUGIN[] = "DeathRun Advanced Life System";
    new const 
AUTHOR[] = "Gh0s7";
    
    static const 
VER[] = "1.1c";
    
    
register_plugin(PLUGINVERAUTHOR);
    
    
register_clcmd("say /lifemenu""ClCmdLifeMenu");
    
register_clcmd("say /lives""ClCmdLives");
    
register_event("DeathMsg""DeathMsg""ad");
    
    
pCvarLifeBuy register_cvar("pCvarLifeBuy""20");
    
pCvarLifeSell register_cvar("pCvarLifeSell""10");
    
pCvarHudsON register_cvar("pCvarHudsON""1");
    
Vault nvault_open("DeathRun-Lives");
}
public 
ClCmdLifeMenu(id)
{    
    new 
Title[64], Item1[64], Item2[64], Item3[64];
    
    
formatex(Titlesizeof(Title), "%s You Have %d %s"Lives[id] > "\y" "\d"Lives[id], Lives[id] != "Lives" "life");
    
formatex(Item1sizeof(Item1), "%s Use one life^n"Lives[id] > "\y" "\d");
    
formatex(Item2sizeof(Item2), "%s Buy one life - $%d"cs_get_user_money(id) >= iLifeBuy "\y" "\d"iLifeBuy);
    
formatex(Item3sizeof(Item3), "%s Sell one life - $%d"Lives[id] > "\y" "\d"iLifeSell);
    
    new 
menu menu_create(Title"LifeMenuHandler");
    
    
menu_additem(menuItem1"1"0);
    
menu_additem(menuItem2"2"0);
    
menu_additem(menuItem3"3"0);
    
    
menu_setprop(menuMPROP_EXITNAME"\yIesire");
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}
public 
LifeMenuHandler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        return 
1;
    }
    
    new 
money cs_get_user_money(id);
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,sizeof(data), szName,sizeof(szName), callback);
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if(
is_user_alive(id))
            {
                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must be dead to use a life! !");
                
ClCmdLifeMenu(id);
                return 
PLUGIN_HANDLED;
            }
            else
            {
                if(
Lives[id] <= 0)
                {
                    
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must to have al least a life to revive !");
                    
ClCmdLifeMenu(id);
                    return 
PLUGIN_HANDLED;
                }
                else
                {
                    
Lives[id] -= 1;
                    
ExecuteHamB(Ham_CS_RoundRespawnid);
                    
ClCmdLifeMenu(id);
                    
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You used a life, now you have^x03 %d %s"Lives[id], Lives[id] == "Life" "Lives");
                }
            }
        }
        case 
2:
        {
            if(
money iLifeBuy)
            {
                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 $%d^x01 to buy one life !"iLifeBuy);
                
ClCmdLifeMenu(id);
                return 
PLUGIN_HANDLED;
            }
            else if(
money >= iLifeBuy)
            {
                
Lives[id] += 1;
                
                
cs_set_user_money(idmoney get_pcvar_num(iLifeBuy))
                
ClCmdLifeMenu(id);
                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You bought a life^x01 and gave^x03 $%d^x01 ! Now you have^x03 %d %s"iLifeBuyLives[id], Lives[id] == "Life" "Lives");
            }
        }
        case 
3:
        {
            if(
Lives[id] <= 0)
            {
                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 at least one life^x01 to sell !");
                
ClCmdLifeMenu(id);
                return 
PLUGIN_HANDLED;
            }
            else
            {
                
Lives[id] -= 1;
                
                
cs_set_user_money(idmoney get_pcvar_num(iLifeSell));
                
ClCmdLifeMenu(id);
                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You sold a life^x01 and you received^x03 $%d^x01 ! Now You have^x03 %d %s"iLifeSellLives[id], Lives[id] == "Life" "Lives");
            }
        }
    }
    
    
menu_destroy(menu);
    return 
1;
}
public 
ClCmdLives(id)
{
    new 
NamePlayer[32];
    
get_user_name(idNamePlayersizeof(NamePlayer) - 1);
    
    
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 Hello^x03 %s^x01! At the moment you have^x03 %d %s^x01 !"NamePlayerLives[id], Lives[id] == "Life" "Lives")
    
    return 
PLUGIN_HANDLED;
}
public 
DeathMsg()
{    
    new 
iHeadShot read_data(3);
    new 
iVictim read_data(2);
    new 
iAttacker read_data(1);
    
    new 
NamePlayer[32];
    
get_user_name(iVictimNamePlayersizeof(NamePlayer) - 1);
    
    
set_hudmessage(0255255, -1.0, -1.0);
    
    if(
iVictim == iAttacker)
        return 
PLUGIN_HANDLED;
    
    if(
iHeadShot && iVictim != iAttacker)
    {
        
Lives[iAttacker] += 2;
        
        if(
iHudsON >= 1)
            
show_hudmessage(iAttacker"[Head Shot] You've got two lives because you killed %s !"NamePlayer);
    }
    if(!
iHeadShot && iVictim != iAttacker)
    {
        
Lives[iAttacker] += 1;
        
        if(
iHudsON >= 1)
            
show_hudmessage(iAttacker"[Kill] You've got one live because you killed %s !"NamePlayer);
    }
    if(
Lives[iVictim] > || (Lives[iVictim] >= && cs_get_user_money(iVictim) >= get_pcvar_num(pCvarLifeBuy)))
        
ClCmdLifeMenu(iVictim);
    
    return 
PLUGIN_CONTINUE;
}
public 
client_putinserver(id)
    
LoadLives(id);
    
public 
client_disconnect(id)
    
SaveLives(id);
    
public 
SaveLives(id)
{
    new 
NamePlayer[32];
    
get_user_name(idNamePlayersizeof(NamePlayer) - 1);
    
    new 
VaultKey[64],VaultData[256];
    
    
format(VaultKey63"%s-DeathRun-Lives"NamePlayer);
    
format(VaultData255"%i "Lives[id]);
    
    
nvault_set(VaultVaultKeyVaultData);
}
public 
LoadLives(id)
{
    new 
NamePlayer[32];
    
get_user_name(idNamePlayersizeof(NamePlayer) - 1);
    
    new 
VaultKey[64], VaultData[256];
    
    
format(VaultKeysizeof(VaultKey) - 1"%s-DeathRun-Lives"NamePlayer);
    
format(VaultDatasizeof(VaultData), "%i "Lives[id]);
    
    
nvault_get(VaultVaultKeyVaultDatasizeof(VaultData));
    
    new 
PlayerLives[32];
    
parse(VaultDataPlayerLivessizeof(PlayerLives) - 1);
    
    
Lives[id] = str_to_num(PlayerLives);
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
morrow is offline
Hedgehog Fog
Senior Member
Join Date: Jun 2010
Location: Ukraine
Old 04-02-2015 , 08:32   Re: [req] very simple edit plugin
Reply With Quote #2

PHP Code:
#include <amxmodx> 
#include <colorchat> 
#include <hamsandwich> 
#include <cstrike> 
#include <nvault> 
#include <fun> 

new Lives[33]; 

new 
pCvarLifeBuypCvarLifeSell
new 
pCvarHudsON

new 
iLifeBuyiLifeSelliHudsON

new 
Vault

public 
plugin_cfg() 
{
        
iLifeBuy get_pcvar_num(pCvarLifeBuy); 
        
iLifeSell get_pcvar_num(pCvarLifeSell); 
        
iHudsON get_pcvar_num(pCvarHudsON); 
}
public 
plugin_init() 
{
        new const 
PLUGIN[] = "DeathRun Advanced Life System"
        new const 
AUTHOR[] = "Gh0s7"
         
        static const 
VER[] = "1.1c"
         
        
register_plugin(PLUGINVERAUTHOR); 
         
        
register_clcmd("say /lifemenu""ClCmdLifeMenu"); 
        
register_clcmd("say /lives""ClCmdLives"); 
        
//register_event("DeathMsg", "DeathMsg", "ad");
        
RegisterHam(Ham_Killed"player""HamKilled"1);
         
        
pCvarLifeBuy register_cvar("pCvarLifeBuy""20"); 
        
pCvarLifeSell register_cvar("pCvarLifeSell""10"); 
        
pCvarHudsON register_cvar("pCvarHudsON""1"); 
        
Vault nvault_open("DeathRun-Lives"); 
}

public 
client_putinserver(id
        
LoadLives(id); 
         
public 
client_disconnect(id
        
SaveLives(id); 

public 
ClCmdLifeMenu(id
{         
        new 
Title[64], Item1[64], Item2[64], Item3[64]; 
         
        
formatex(Titlesizeof(Title), "%s You Have %d %s"Lives[id] > "\y" "\d"Lives[id], Lives[id] != "Lives" "life"); 
        
formatex(Item1sizeof(Item1), "%s Use one life^n"Lives[id] > "\y" "\d"); 
        
formatex(Item2sizeof(Item2), "%s Buy one life - $%d"cs_get_user_money(id) >= iLifeBuy "\y" "\d"iLifeBuy); 
        
formatex(Item3sizeof(Item3), "%s Sell one life - $%d"Lives[id] > "\y" "\d"iLifeSell); 
         
        new 
menu menu_create(Title"LifeMenuHandler"); 
         
        
menu_additem(menuItem1"1"0); 
        
menu_additem(menuItem2"2"0); 
        
menu_additem(menuItem3"3"0); 
         
        
menu_setprop(menuMPROP_EXITNAME"\yIesire"); 
        
menu_display(idmenu0); 
         
        return 
PLUGIN_HANDLED
}
public 
LifeMenuHandler(idmenuitem
{
        if(
item == MENU_EXIT
        {
                return 
1
        }
         
        new 
money cs_get_user_money(id); 
         
        new 
data[6], szName[64]; 
        new 
accesscallback
        
menu_item_getinfo(menuitemaccessdata,sizeof(data), szName,sizeof(szName), callback); 
        new 
key str_to_num(data); 
         
        switch(
key
        {
                case 
1
                {
                        if(
is_user_alive(id)) 
                        {
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must be dead to use a life! !"); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        }
                        else 
                        {
                                if(
Lives[id] <= 0
                                {
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must to have al least a life to revive !"); 
                                        
ClCmdLifeMenu(id); 
                                        return 
PLUGIN_HANDLED
                                }
                                else 
                                {
                                        
Lives[id] -= 1
                                        
ExecuteHamB(Ham_CS_RoundRespawnid); 
                                        
ClCmdLifeMenu(id); 
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You used a life, now you have^x03 %d %s"Lives[id], Lives[id] == "Life" "Lives"); 
                                }
                        }
                }
                case 
2
                {
                        if(
money iLifeBuy
                        {
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 $%d^x01 to buy one life !"iLifeBuy); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        }
                        else if(
money >= iLifeBuy
                        {
                                
Lives[id] += 1
                                 
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeBuy)) 
                                
ClCmdLifeMenu(id); 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You bought a life^x01 and gave^x03 $%d^x01 ! Now you have^x03 %d %s"iLifeBuyLives[id], Lives[id] == "Life" "Lives"); 
                        }
                }
                case 
3
                {
                        if(
Lives[id] <= 0
                        {
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 at least one life^x01 to sell !"); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        }
                        else 
                        {
                                
Lives[id] -= 1
                                 
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeSell)); 
                                
ClCmdLifeMenu(id); 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You sold a life^x01 and you received^x03 $%d^x01 ! Now You have^x03 %d %s"iLifeSellLives[id], Lives[id] == "Life" "Lives"); 
                        }
                }
        }
         
        
menu_destroy(menu); 
        return 
1
}
public 
ClCmdLives(id
{
        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 Hello^x03 %s^x01! At the moment you have^x03 %d %s^x01 !"NamePlayerLives[id], Lives[id] == "Life" "Lives"
         
        return 
PLUGIN_HANDLED
}

public 
HamKilled(iVictimiAttacker)
{

        
/*-------------------------------*/
        
        
new bool:bHeadShot;
        
        new 
hitGroup get_pdata_int(victimID 75);
        
        if(
hitGroup == HIT_HEAD)
            
bHeadShot true;
            
        
/*-------------------------------*/
        
        
new NamePlayer[32]; 
        
get_user_name(iVictimNamePlayercharsmax(NamePlayer)); 
         
        
set_hudmessage(0255255, -1.0, -1.0); 
         
        if(
iVictim == iAttacker
                return 
HAM_IGNORED
         
        if(
bHeadShot
        {
                
Lives[iAttacker] += 2
                 
                if(
iHudsON >= 1
                        
show_hudmessage(iAttacker"[Head Shot] You've got two lives because you killed %s !"NamePlayer); 
        }
        else
        {
                
Lives[iAttacker] += 1
                 
                if(
iHudsON >= 1
                        
show_hudmessage(iAttacker"[Kill] You've got one live because you killed %s !"NamePlayer); 
        }
        
        if(
Lives[iVictim] > || (Lives[iVictim] >= && cs_get_user_money(iVictim) >= get_pcvar_num(pCvarLifeBuy))) 
                
ClCmdLifeMenu(iVictim); 
         
        return 
HAM_IGNORED
}
         
public 
SaveLives(id
{
        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        new 
VaultKey[64],VaultData[256]; 
         
        
format(VaultKey63"%s-DeathRun-Lives"NamePlayer); 
        
format(VaultData255"%i "Lives[id]); 
         
        
nvault_set(VaultVaultKeyVaultData); 
}
public 
LoadLives(id
{
        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        new 
VaultKey[64], VaultData[256]; 
         
        
format(VaultKeysizeof(VaultKey) - 1"%s-DeathRun-Lives"NamePlayer); 
        
format(VaultDatasizeof(VaultData), "%i "Lives[id]); 
         
        
nvault_get(VaultVaultKeyVaultDatasizeof(VaultData)); 
         
        new 
PlayerLives[32]; 
        
parse(VaultDataPlayerLivessizeof(PlayerLives) - 1); 
         
        
Lives[id] = str_to_num(PlayerLives); 

__________________

❄️ CS Snow Wars - Mod based on snowballs fights
🧟 CS Zombie Panic - A port of HL Zombie Panic!
🎃 CS Halloween Mod - Completely new gamemode for Halloween Holidays
📦 AMXXPack - CLI and build system for amxx projects
🔧 Custom Entities API - API to register custom entities

Last edited by Hedgehog Fog; 04-02-2015 at 08:45.
Hedgehog Fog is offline
morrow
Member
Join Date: Dec 2008
Old 04-02-2015 , 08:38   Re: [req] very simple edit plugin
Reply With Quote #3

Quote:
Originally Posted by Hedgehog95 View Post
PHP Code:
#include <amxmodx> 
#include <colorchat> 
#include <hamsandwich> 
#include <cstrike> 
#include <nvault> 
#include <fun> 

new Lives[33]; 

new 
pCvarLifeBuypCvarLifeSell
new 
pCvarHudsON

new 
iLifeBuyiLifeSelliHudsON

new 
Vault

public 
plugin_cfg() 

        
iLifeBuy get_pcvar_num(pCvarLifeBuy); 
        
iLifeSell get_pcvar_num(pCvarLifeSell); 
        
iHudsON get_pcvar_num(pCvarHudsON); 

public 
plugin_init() 

        new const 
PLUGIN[] = "DeathRun Advanced Life System"
        new const 
AUTHOR[] = "Gh0s7"
         
        static const 
VER[] = "1.1c"
         
        
register_plugin(PLUGINVERAUTHOR); 
         
        
register_clcmd("say /lifemenu""ClCmdLifeMenu"); 
        
register_clcmd("say /lives""ClCmdLives"); 
        
//register_event("DeathMsg", "DeathMsg", "ad");
        
RegisterHam(Ham_Killed"player""Ham_Killed"1);
         
        
pCvarLifeBuy register_cvar("pCvarLifeBuy""20"); 
        
pCvarLifeSell register_cvar("pCvarLifeSell""10"); 
        
pCvarHudsON register_cvar("pCvarHudsON""1"); 
        
Vault nvault_open("DeathRun-Lives"); 


public 
client_putinserver(id
        
LoadLives(id); 
         
public 
client_disconnect(id
        
SaveLives(id); 

public 
ClCmdLifeMenu(id
{         
        new 
Title[64], Item1[64], Item2[64], Item3[64]; 
         
        
formatex(Titlesizeof(Title), "%s You Have %d %s"Lives[id] > "\y" "\d"Lives[id], Lives[id] != "Lives" "life"); 
        
formatex(Item1sizeof(Item1), "%s Use one life^n"Lives[id] > "\y" "\d"); 
        
formatex(Item2sizeof(Item2), "%s Buy one life - $%d"cs_get_user_money(id) >= iLifeBuy "\y" "\d"iLifeBuy); 
        
formatex(Item3sizeof(Item3), "%s Sell one life - $%d"Lives[id] > "\y" "\d"iLifeSell); 
         
        new 
menu menu_create(Title"LifeMenuHandler"); 
         
        
menu_additem(menuItem1"1"0); 
        
menu_additem(menuItem2"2"0); 
        
menu_additem(menuItem3"3"0); 
         
        
menu_setprop(menuMPROP_EXITNAME"\yIesire"); 
        
menu_display(idmenu0); 
         
        return 
PLUGIN_HANDLED

public 
LifeMenuHandler(idmenuitem

        if(
item == MENU_EXIT
        { 
                return 
1
        } 
         
        new 
money cs_get_user_money(id); 
         
        new 
data[6], szName[64]; 
        new 
accesscallback
        
menu_item_getinfo(menuitemaccessdata,sizeof(data), szName,sizeof(szName), callback); 
        new 
key str_to_num(data); 
         
        switch(
key
        { 
                case 
1
                { 
                        if(
is_user_alive(id)) 
                        { 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must be dead to use a life! !"); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        } 
                        else 
                        { 
                                if(
Lives[id] <= 0
                                { 
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must to have al least a life to revive !"); 
                                        
ClCmdLifeMenu(id); 
                                        return 
PLUGIN_HANDLED
                                } 
                                else 
                                { 
                                        
Lives[id] -= 1
                                        
ExecuteHamB(Ham_CS_RoundRespawnid); 
                                        
ClCmdLifeMenu(id); 
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You used a life, now you have^x03 %d %s"Lives[id], Lives[id] == "Life" "Lives"); 
                                } 
                        } 
                } 
                case 
2
                { 
                        if(
money iLifeBuy
                        { 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 $%d^x01 to buy one life !"iLifeBuy); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        } 
                        else if(
money >= iLifeBuy
                        { 
                                
Lives[id] += 1
                                 
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeBuy)) 
                                
ClCmdLifeMenu(id); 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You bought a life^x01 and gave^x03 $%d^x01 ! Now you have^x03 %d %s"iLifeBuyLives[id], Lives[id] == "Life" "Lives"); 
                        } 
                } 
                case 
3
                { 
                        if(
Lives[id] <= 0
                        { 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 at least one life^x01 to sell !"); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        } 
                        else 
                        { 
                                
Lives[id] -= 1
                                 
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeSell)); 
                                
ClCmdLifeMenu(id); 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You sold a life^x01 and you received^x03 $%d^x01 ! Now You have^x03 %d %s"iLifeSellLives[id], Lives[id] == "Life" "Lives"); 
                        } 
                } 
        } 
         
        
menu_destroy(menu); 
        return 
1

public 
ClCmdLives(id

        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 Hello^x03 %s^x01! At the moment you have^x03 %d %s^x01 !"NamePlayerLives[id], Lives[id] == "Life" "Lives"
         
        return 
PLUGIN_HANDLED
}

public 
Ham_Killed(iVictimiAttacker)
{

        
/*-------------------------------*/
        
        
new bool:bHeadShot;
        
        new 
hitGroup get_pdata_int(victimID 75);
        
        if(
hitGroup == HIT_HEAD)
            
bHeadShot true;
            
        
/*-------------------------------*/
        
        
new NamePlayer[32]; 
        
get_user_name(iVictimNamePlayersizeof(NamePlayer) - 1); 
         
        
set_hudmessage(0255255, -1.0, -1.0); 
         
        if(
iVictim == iAttacker
                return 
PLUGIN_HANDLED
         
        if(
bHeadShot && iVictim != iAttacker
        { 
                
Lives[iAttacker] += 2
                 
                if(
iHudsON >= 1
                        
show_hudmessage(iAttacker"[Head Shot] You've got two lives because you killed %s !"NamePlayer); 
        } 
        if(!
bHeadShot && iVictim != iAttacker
        { 
                
Lives[iAttacker] += 1
                 
                if(
iHudsON >= 1
                        
show_hudmessage(iAttacker"[Kill] You've got one live because you killed %s !"NamePlayer); 
        } 
        if(
Lives[iVictim] > || (Lives[iVictim] >= && cs_get_user_money(iVictim) >= get_pcvar_num(pCvarLifeBuy))) 
                
ClCmdLifeMenu(iVictim); 
         
        return 
PLUGIN_CONTINUE
}
         
public 
SaveLives(id

        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        new 
VaultKey[64],VaultData[256]; 
         
        
format(VaultKey63"%s-DeathRun-Lives"NamePlayer); 
        
format(VaultData255"%i "Lives[id]); 
         
        
nvault_set(VaultVaultKeyVaultData); 

public 
LoadLives(id

        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        new 
VaultKey[64], VaultData[256]; 
         
        
format(VaultKeysizeof(VaultKey) - 1"%s-DeathRun-Lives"NamePlayer); 
        
format(VaultDatasizeof(VaultData), "%i "Lives[id]); 
         
        
nvault_get(VaultVaultKeyVaultDatasizeof(VaultData)); 
         
        new 
PlayerLives[32]; 
        
parse(VaultDataPlayerLivessizeof(PlayerLives) - 1); 
         
        
Lives[id] = str_to_num(PlayerLives); 



ERROR compile: RegisterHam(Ham_Killed, "player", "Ham_Killed", 1);
morrow is offline
Hedgehog Fog
Senior Member
Join Date: Jun 2010
Location: Ukraine
Old 04-02-2015 , 08:45   Re: [req] very simple edit plugin
Reply With Quote #4

PHP Code:
RegisterHam(Ham_Killed"player""HamKilled"1); 
PHP Code:
public HamKilled(iVictimiAttacker
Post updated.
__________________

❄️ CS Snow Wars - Mod based on snowballs fights
🧟 CS Zombie Panic - A port of HL Zombie Panic!
🎃 CS Halloween Mod - Completely new gamemode for Halloween Holidays
📦 AMXXPack - CLI and build system for amxx projects
🔧 Custom Entities API - API to register custom entities

Last edited by Hedgehog Fog; 04-02-2015 at 08:47.
Hedgehog Fog is offline
morrow
Member
Join Date: Dec 2008
Old 04-02-2015 , 08:51   Re: [req] very simple edit plugin
Reply With Quote #5

Quote:
Originally Posted by Hedgehog95 View Post
PHP Code:
RegisterHam(Ham_Killed"player""HamKilled"1); 
PHP Code:
public HamKilled(iVictimiAttacker
Post updated.
Can you add this in code i try compile.. i dont know much about pawn
morrow is offline
Hedgehog Fog
Senior Member
Join Date: Jun 2010
Location: Ukraine
Old 04-02-2015 , 08:54   Re: [req] very simple edit plugin
Reply With Quote #6

morrow,
I updated previous post.

https://forums.alliedmods.net/showpo...02&postcount=2
__________________

❄️ CS Snow Wars - Mod based on snowballs fights
🧟 CS Zombie Panic - A port of HL Zombie Panic!
🎃 CS Halloween Mod - Completely new gamemode for Halloween Holidays
📦 AMXXPack - CLI and build system for amxx projects
🔧 Custom Entities API - API to register custom entities

Last edited by Hedgehog Fog; 04-02-2015 at 08:56.
Hedgehog Fog is offline
morrow
Member
Join Date: Dec 2008
Old 04-02-2015 , 09:22   Re: [req] very simple edit plugin
Reply With Quote #7

Quote:
Originally Posted by Hedgehog95 View Post
error line 166: new hitGroup = get_pdata_int(victimID , 75);
morrow is offline
Hedgehog Fog
Senior Member
Join Date: Jun 2010
Location: Ukraine
Old 04-02-2015 , 09:28   Re: [req] very simple edit plugin
Reply With Quote #8

morrow,
Oops, my bad.

PHP Code:
#include <amxmodx>  
#include <colorchat>  
#include <hamsandwich>  
#include <cstrike>  
#include <nvault>  
#include <fun>  

new Lives[33];  

new 
pCvarLifeBuypCvarLifeSell;  
new 
pCvarHudsON;  

new 
iLifeBuyiLifeSelliHudsON;  

new 
Vault;  

public 
plugin_cfg()  
{  
        
iLifeBuy get_pcvar_num(pCvarLifeBuy);  
        
iLifeSell get_pcvar_num(pCvarLifeSell);  
        
iHudsON get_pcvar_num(pCvarHudsON);  
}  
public 
plugin_init()  
{  
        new const 
PLUGIN[] = "DeathRun Advanced Life System";  
        new const 
AUTHOR[] = "Gh0s7";  
          
        static const 
VER[] = "1.1c";  
          
        
register_plugin(PLUGINVERAUTHOR);  
          
        
register_clcmd("say /lifemenu""ClCmdLifeMenu");  
        
register_clcmd("say /lives""ClCmdLives");  
        
//register_event("DeathMsg", "DeathMsg", "ad"); 
        
RegisterHam(Ham_Killed"player""Ham_Killed"1); 
          
        
pCvarLifeBuy register_cvar("pCvarLifeBuy""20");  
        
pCvarLifeSell register_cvar("pCvarLifeSell""10");  
        
pCvarHudsON register_cvar("pCvarHudsON""1");  
        
Vault nvault_open("DeathRun-Lives");  
}  

public 
client_putinserver(id)  
        
LoadLives(id);  
          
public 
client_disconnect(id)  
        
SaveLives(id);  

public 
ClCmdLifeMenu(id)  
{          
        new 
Title[64], Item1[64], Item2[64], Item3[64];  
          
        
formatex(Titlesizeof(Title), "%s You Have %d %s"Lives[id] > "\y" "\d"Lives[id], Lives[id] != "Lives" "life");  
        
formatex(Item1sizeof(Item1), "%s Use one life^n"Lives[id] > "\y" "\d");  
        
formatex(Item2sizeof(Item2), "%s Buy one life - $%d"cs_get_user_money(id) >= iLifeBuy "\y" "\d"iLifeBuy);  
        
formatex(Item3sizeof(Item3), "%s Sell one life - $%d"Lives[id] > "\y" "\d"iLifeSell);  
          
        new 
menu menu_create(Title"LifeMenuHandler");  
          
        
menu_additem(menuItem1"1"0);  
        
menu_additem(menuItem2"2"0);  
        
menu_additem(menuItem3"3"0);  
          
        
menu_setprop(menuMPROP_EXITNAME"\yIesire");  
        
menu_display(idmenu0);  
          
        return 
PLUGIN_HANDLED;  
}  
public 
LifeMenuHandler(idmenuitem)  
{  
        if(
item == MENU_EXIT)  
        {  
                return 
1;  
        }  
          
        new 
money cs_get_user_money(id);  
          
        new 
data[6], szName[64];  
        new 
accesscallback;  
        
menu_item_getinfo(menuitemaccessdata,sizeof(data), szName,sizeof(szName), callback);  
        new 
key str_to_num(data);  
          
        switch(
key)  
        {  
                case 
1:  
                {  
                        if(
is_user_alive(id))  
                        {  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must be dead to use a life! !");  
                                
ClCmdLifeMenu(id);  
                                return 
PLUGIN_HANDLED;  
                        }  
                        else  
                        {  
                                if(
Lives[id] <= 0)  
                                {  
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must to have al least a life to revive !");  
                                        
ClCmdLifeMenu(id);  
                                        return 
PLUGIN_HANDLED;  
                                }  
                                else  
                                {  
                                        
Lives[id] -= 1;  
                                        
ExecuteHamB(Ham_CS_RoundRespawnid);  
                                        
ClCmdLifeMenu(id);  
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You used a life, now you have^x03 %d %s"Lives[id], Lives[id] == "Life" "Lives");  
                                }  
                        }  
                }  
                case 
2:  
                {  
                        if(
money iLifeBuy)  
                        {  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 $%d^x01 to buy one life !"iLifeBuy);  
                                
ClCmdLifeMenu(id);  
                                return 
PLUGIN_HANDLED;  
                        }  
                        else if(
money >= iLifeBuy)  
                        {  
                                
Lives[id] += 1;  
                                  
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeBuy))  
                                
ClCmdLifeMenu(id);  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You bought a life^x01 and gave^x03 $%d^x01 ! Now you have^x03 %d %s"iLifeBuyLives[id], Lives[id] == "Life" "Lives");  
                        }  
                }  
                case 
3:  
                {  
                        if(
Lives[id] <= 0)  
                        {  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 at least one life^x01 to sell !");  
                                
ClCmdLifeMenu(id);  
                                return 
PLUGIN_HANDLED;  
                        }  
                        else  
                        {  
                                
Lives[id] -= 1;  
                                  
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeSell));  
                                
ClCmdLifeMenu(id);  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You sold a life^x01 and you received^x03 $%d^x01 ! Now You have^x03 %d %s"iLifeSellLives[id], Lives[id] == "Life" "Lives");  
                        }  
                }  
        }  
          
        
menu_destroy(menu);  
        return 
1;  
}  
public 
ClCmdLives(id)  
{  
        new 
NamePlayer[32];  
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1);  
          
        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 Hello^x03 %s^x01! At the moment you have^x03 %d %s^x01 !"NamePlayerLives[id], Lives[id] == "Life" "Lives")  
          
        return 
PLUGIN_HANDLED;  


public 
Ham_Killed(iVictimiAttacker


        
/*-------------------------------*/ 
         
        
new bool:bHeadShot
         
        new 
hitGroup get_pdata_int(iVictim 75); 
         
        if(
hitGroup == HIT_HEAD
            
bHeadShot true
             
        
/*-------------------------------*/ 
         
        
new NamePlayer[32];  
        
get_user_name(iVictimNamePlayersizeof(NamePlayer) - 1);  
          
        
set_hudmessage(0255255, -1.0, -1.0);  
          
        if(
iVictim == iAttacker)  
                return 
PLUGIN_HANDLED;  
          
        if(
bHeadShot && iVictim != iAttacker)  
        {  
                
Lives[iAttacker] += 2;  
                  
                if(
iHudsON >= 1)  
                        
show_hudmessage(iAttacker"[Head Shot] You've got two lives because you killed %s !"NamePlayer);  
        }  
        if(!
bHeadShot && iVictim != iAttacker)  
        {  
                
Lives[iAttacker] += 1;  
                  
                if(
iHudsON >= 1)  
                        
show_hudmessage(iAttacker"[Kill] You've got one live because you killed %s !"NamePlayer);  
        }  
        if(
Lives[iVictim] > || (Lives[iVictim] >= && cs_get_user_money(iVictim) >= get_pcvar_num(pCvarLifeBuy)))  
                
ClCmdLifeMenu(iVictim);  
          
        return 
PLUGIN_CONTINUE;  

          
public 
SaveLives(id)  
{  
        new 
NamePlayer[32];  
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1);  
          
        new 
VaultKey[64],VaultData[256];  
          
        
format(VaultKey63"%s-DeathRun-Lives"NamePlayer);  
        
format(VaultData255"%i "Lives[id]);  
          
        
nvault_set(VaultVaultKeyVaultData);  
}  
public 
LoadLives(id)  
{  
        new 
NamePlayer[32];  
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1);  
          
        new 
VaultKey[64], VaultData[256];  
          
        
format(VaultKeysizeof(VaultKey) - 1"%s-DeathRun-Lives"NamePlayer);  
        
format(VaultDatasizeof(VaultData), "%i "Lives[id]);  
          
        
nvault_get(VaultVaultKeyVaultDatasizeof(VaultData));  
          
        new 
PlayerLives[32];  
        
parse(VaultDataPlayerLivessizeof(PlayerLives) - 1);  
          
        
Lives[id] = str_to_num(PlayerLives);  

__________________

❄️ CS Snow Wars - Mod based on snowballs fights
🧟 CS Zombie Panic - A port of HL Zombie Panic!
🎃 CS Halloween Mod - Completely new gamemode for Halloween Holidays
📦 AMXXPack - CLI and build system for amxx projects
🔧 Custom Entities API - API to register custom entities
Hedgehog Fog is offline
morrow
Member
Join Date: Dec 2008
Old 04-02-2015 , 10:14   Re: [req] very simple edit plugin
Reply With Quote #9

Quote:
Originally Posted by Hedgehog95 View Post
morrow,
Oops, my bad.

PHP Code:
#include <amxmodx>  
#include <colorchat>  
#include <hamsandwich>  
#include <cstrike>  
#include <nvault>  
#include <fun>  

new Lives[33];  

new 
pCvarLifeBuypCvarLifeSell;  
new 
pCvarHudsON;  

new 
iLifeBuyiLifeSelliHudsON;  

new 
Vault;  

public 
plugin_cfg()  
{  
        
iLifeBuy get_pcvar_num(pCvarLifeBuy);  
        
iLifeSell get_pcvar_num(pCvarLifeSell);  
        
iHudsON get_pcvar_num(pCvarHudsON);  
}  
public 
plugin_init()  
{  
        new const 
PLUGIN[] = "DeathRun Advanced Life System";  
        new const 
AUTHOR[] = "Gh0s7";  
          
        static const 
VER[] = "1.1c";  
          
        
register_plugin(PLUGINVERAUTHOR);  
          
        
register_clcmd("say /lifemenu""ClCmdLifeMenu");  
        
register_clcmd("say /lives""ClCmdLives");  
        
//register_event("DeathMsg", "DeathMsg", "ad"); 
        
RegisterHam(Ham_Killed"player""Ham_Killed"1); 
          
        
pCvarLifeBuy register_cvar("pCvarLifeBuy""20");  
        
pCvarLifeSell register_cvar("pCvarLifeSell""10");  
        
pCvarHudsON register_cvar("pCvarHudsON""1");  
        
Vault nvault_open("DeathRun-Lives");  
}  

public 
client_putinserver(id)  
        
LoadLives(id);  
          
public 
client_disconnect(id)  
        
SaveLives(id);  

public 
ClCmdLifeMenu(id)  
{          
        new 
Title[64], Item1[64], Item2[64], Item3[64];  
          
        
formatex(Titlesizeof(Title), "%s You Have %d %s"Lives[id] > "\y" "\d"Lives[id], Lives[id] != "Lives" "life");  
        
formatex(Item1sizeof(Item1), "%s Use one life^n"Lives[id] > "\y" "\d");  
        
formatex(Item2sizeof(Item2), "%s Buy one life - $%d"cs_get_user_money(id) >= iLifeBuy "\y" "\d"iLifeBuy);  
        
formatex(Item3sizeof(Item3), "%s Sell one life - $%d"Lives[id] > "\y" "\d"iLifeSell);  
          
        new 
menu menu_create(Title"LifeMenuHandler");  
          
        
menu_additem(menuItem1"1"0);  
        
menu_additem(menuItem2"2"0);  
        
menu_additem(menuItem3"3"0);  
          
        
menu_setprop(menuMPROP_EXITNAME"\yIesire");  
        
menu_display(idmenu0);  
          
        return 
PLUGIN_HANDLED;  
}  
public 
LifeMenuHandler(idmenuitem)  
{  
        if(
item == MENU_EXIT)  
        {  
                return 
1;  
        }  
          
        new 
money cs_get_user_money(id);  
          
        new 
data[6], szName[64];  
        new 
accesscallback;  
        
menu_item_getinfo(menuitemaccessdata,sizeof(data), szName,sizeof(szName), callback);  
        new 
key str_to_num(data);  
          
        switch(
key)  
        {  
                case 
1:  
                {  
                        if(
is_user_alive(id))  
                        {  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must be dead to use a life! !");  
                                
ClCmdLifeMenu(id);  
                                return 
PLUGIN_HANDLED;  
                        }  
                        else  
                        {  
                                if(
Lives[id] <= 0)  
                                {  
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must to have al least a life to revive !");  
                                        
ClCmdLifeMenu(id);  
                                        return 
PLUGIN_HANDLED;  
                                }  
                                else  
                                {  
                                        
Lives[id] -= 1;  
                                        
ExecuteHamB(Ham_CS_RoundRespawnid);  
                                        
ClCmdLifeMenu(id);  
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You used a life, now you have^x03 %d %s"Lives[id], Lives[id] == "Life" "Lives");  
                                }  
                        }  
                }  
                case 
2:  
                {  
                        if(
money iLifeBuy)  
                        {  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 $%d^x01 to buy one life !"iLifeBuy);  
                                
ClCmdLifeMenu(id);  
                                return 
PLUGIN_HANDLED;  
                        }  
                        else if(
money >= iLifeBuy)  
                        {  
                                
Lives[id] += 1;  
                                  
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeBuy))  
                                
ClCmdLifeMenu(id);  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You bought a life^x01 and gave^x03 $%d^x01 ! Now you have^x03 %d %s"iLifeBuyLives[id], Lives[id] == "Life" "Lives");  
                        }  
                }  
                case 
3:  
                {  
                        if(
Lives[id] <= 0)  
                        {  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 at least one life^x01 to sell !");  
                                
ClCmdLifeMenu(id);  
                                return 
PLUGIN_HANDLED;  
                        }  
                        else  
                        {  
                                
Lives[id] -= 1;  
                                  
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeSell));  
                                
ClCmdLifeMenu(id);  
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You sold a life^x01 and you received^x03 $%d^x01 ! Now You have^x03 %d %s"iLifeSellLives[id], Lives[id] == "Life" "Lives");  
                        }  
                }  
        }  
          
        
menu_destroy(menu);  
        return 
1;  
}  
public 
ClCmdLives(id)  
{  
        new 
NamePlayer[32];  
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1);  
          
        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 Hello^x03 %s^x01! At the moment you have^x03 %d %s^x01 !"NamePlayerLives[id], Lives[id] == "Life" "Lives")  
          
        return 
PLUGIN_HANDLED;  


public 
Ham_Killed(iVictimiAttacker


        
/*-------------------------------*/ 
         
        
new bool:bHeadShot
         
        new 
hitGroup get_pdata_int(iVictim 75); 
         
        if(
hitGroup == HIT_HEAD
            
bHeadShot true
             
        
/*-------------------------------*/ 
         
        
new NamePlayer[32];  
        
get_user_name(iVictimNamePlayersizeof(NamePlayer) - 1);  
          
        
set_hudmessage(0255255, -1.0, -1.0);  
          
        if(
iVictim == iAttacker)  
                return 
PLUGIN_HANDLED;  
          
        if(
bHeadShot && iVictim != iAttacker)  
        {  
                
Lives[iAttacker] += 2;  
                  
                if(
iHudsON >= 1)  
                        
show_hudmessage(iAttacker"[Head Shot] You've got two lives because you killed %s !"NamePlayer);  
        }  
        if(!
bHeadShot && iVictim != iAttacker)  
        {  
                
Lives[iAttacker] += 1;  
                  
                if(
iHudsON >= 1)  
                        
show_hudmessage(iAttacker"[Kill] You've got one live because you killed %s !"NamePlayer);  
        }  
        if(
Lives[iVictim] > || (Lives[iVictim] >= && cs_get_user_money(iVictim) >= get_pcvar_num(pCvarLifeBuy)))  
                
ClCmdLifeMenu(iVictim);  
          
        return 
PLUGIN_CONTINUE;  

          
public 
SaveLives(id)  
{  
        new 
NamePlayer[32];  
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1);  
          
        new 
VaultKey[64],VaultData[256];  
          
        
format(VaultKey63"%s-DeathRun-Lives"NamePlayer);  
        
format(VaultData255"%i "Lives[id]);  
          
        
nvault_set(VaultVaultKeyVaultData);  
}  
public 
LoadLives(id)  
{  
        new 
NamePlayer[32];  
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1);  
          
        new 
VaultKey[64], VaultData[256];  
          
        
format(VaultKeysizeof(VaultKey) - 1"%s-DeathRun-Lives"NamePlayer);  
        
format(VaultDatasizeof(VaultData), "%i "Lives[id]);  
          
        
nvault_get(VaultVaultKeyVaultDatasizeof(VaultData));  
          
        new 
PlayerLives[32];  
        
parse(VaultDataPlayerLivessizeof(PlayerLives) - 1);  
          
        
Lives[id] = str_to_num(PlayerLives);  



error line 35

RegisterHam(Ham_Killed, "player", "Ham_Killed", 1);

does it fixible ?
morrow is offline
Hedgehog Fog
Senior Member
Join Date: Jun 2010
Location: Ukraine
Old 04-02-2015 , 10:18   Re: [req] very simple edit plugin
Reply With Quote #10

morrow,
Sorry, I paste old version.
PHP Code:
#include <amxmodx> 
#include <colorchat> 
#include <hamsandwich> 
#include <fakemeta>
#include <cstrike> 
#include <nvault> 
#include <fun> 

new Lives[33]; 

new 
pCvarLifeBuypCvarLifeSell
new 
pCvarHudsON

new 
iLifeBuyiLifeSelliHudsON

new 
Vault

public 
plugin_cfg() 
{
        
iLifeBuy get_pcvar_num(pCvarLifeBuy); 
        
iLifeSell get_pcvar_num(pCvarLifeSell); 
        
iHudsON get_pcvar_num(pCvarHudsON); 
}
public 
plugin_init() 
{
        new const 
PLUGIN[] = "DeathRun Advanced Life System"
        new const 
AUTHOR[] = "Gh0s7"
         
        static const 
VER[] = "1.1c"
         
        
register_plugin(PLUGINVERAUTHOR); 
         
        
register_clcmd("say /lifemenu""ClCmdLifeMenu"); 
        
register_clcmd("say /lives""ClCmdLives"); 
        
//register_event("DeathMsg", "DeathMsg", "ad");
        
RegisterHam(Ham_Killed"player""HamKilled"1);
         
        
pCvarLifeBuy register_cvar("pCvarLifeBuy""20"); 
        
pCvarLifeSell register_cvar("pCvarLifeSell""10"); 
        
pCvarHudsON register_cvar("pCvarHudsON""1"); 
        
Vault nvault_open("DeathRun-Lives"); 
}

public 
client_putinserver(id
        
LoadLives(id); 
         
public 
client_disconnect(id
        
SaveLives(id); 

public 
ClCmdLifeMenu(id
{         
        new 
Title[64], Item1[64], Item2[64], Item3[64]; 
         
        
formatex(Titlesizeof(Title), "%s You Have %d %s"Lives[id] > "\y" "\d"Lives[id], Lives[id] != "Lives" "life"); 
        
formatex(Item1sizeof(Item1), "%s Use one life^n"Lives[id] > "\y" "\d"); 
        
formatex(Item2sizeof(Item2), "%s Buy one life - $%d"cs_get_user_money(id) >= iLifeBuy "\y" "\d"iLifeBuy); 
        
formatex(Item3sizeof(Item3), "%s Sell one life - $%d"Lives[id] > "\y" "\d"iLifeSell); 
         
        new 
menu menu_create(Title"LifeMenuHandler"); 
         
        
menu_additem(menuItem1"1"0); 
        
menu_additem(menuItem2"2"0); 
        
menu_additem(menuItem3"3"0); 
         
        
menu_setprop(menuMPROP_EXITNAME"\yIesire"); 
        
menu_display(idmenu0); 
         
        return 
PLUGIN_HANDLED
}
public 
LifeMenuHandler(idmenuitem
{
        if(
item == MENU_EXIT
        {
                return 
1
        }
         
        new 
money cs_get_user_money(id); 
         
        new 
data[6], szName[64]; 
        new 
accesscallback
        
menu_item_getinfo(menuitemaccessdata,sizeof(data), szName,sizeof(szName), callback); 
        new 
key str_to_num(data); 
         
        switch(
key
        {
                case 
1
                {
                        if(
is_user_alive(id)) 
                        {
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must be dead to use a life! !"); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        }
                        else 
                        {
                                if(
Lives[id] <= 0
                                {
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You must to have al least a life to revive !"); 
                                        
ClCmdLifeMenu(id); 
                                        return 
PLUGIN_HANDLED
                                }
                                else 
                                {
                                        
Lives[id] -= 1
                                        
ExecuteHamB(Ham_CS_RoundRespawnid); 
                                        
ClCmdLifeMenu(id); 
                                        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You used a life, now you have^x03 %d %s"Lives[id], Lives[id] == "Life" "Lives"); 
                                }
                        }
                }
                case 
2
                {
                        if(
money iLifeBuy
                        {
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 $%d^x01 to buy one life !"iLifeBuy); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        }
                        else if(
money >= iLifeBuy
                        {
                                
Lives[id] += 1
                                 
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeBuy)) 
                                
ClCmdLifeMenu(id); 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You bought a life^x01 and gave^x03 $%d^x01 ! Now you have^x03 %d %s"iLifeBuyLives[id], Lives[id] == "Life" "Lives"); 
                        }
                }
                case 
3
                {
                        if(
Lives[id] <= 0
                        {
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 You need^x03 at least one life^x01 to sell !"); 
                                
ClCmdLifeMenu(id); 
                                return 
PLUGIN_HANDLED
                        }
                        else 
                        {
                                
Lives[id] -= 1
                                 
                                
cs_set_user_money(idmoney get_pcvar_num(iLifeSell)); 
                                
ClCmdLifeMenu(id); 
                                
ColorChat(idRED"^x04 [DeathRun - Lives]^x03 You sold a life^x01 and you received^x03 $%d^x01 ! Now You have^x03 %d %s"iLifeSellLives[id], Lives[id] == "Life" "Lives"); 
                        }
                }
        }
         
        
menu_destroy(menu); 
        return 
1
}
public 
ClCmdLives(id
{
        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        
ColorChat(idRED"^x04 [DeathRun - Lives]^x01 Hello^x03 %s^x01! At the moment you have^x03 %d %s^x01 !"NamePlayerLives[id], Lives[id] == "Life" "Lives"
         
        return 
PLUGIN_HANDLED
}

public 
HamKilled(iVictimiAttacker)
{

        
/*-------------------------------*/
        
        
new bool:bHeadShot;
        
        new 
hitGroup get_pdata_int(iVictim 75);
        
        if(
hitGroup == HIT_HEAD)
            
bHeadShot true;
            
        
/*-------------------------------*/
        
        
new NamePlayer[32]; 
        
get_user_name(iVictimNamePlayercharsmax(NamePlayer)); 
         
        
set_hudmessage(0255255, -1.0, -1.0); 
         
        if(
iVictim == iAttacker
                return 
HAM_IGNORED
         
        if(
bHeadShot
        {
                
Lives[iAttacker] += 2
                 
                if(
iHudsON >= 1
                        
show_hudmessage(iAttacker"[Head Shot] You've got two lives because you killed %s !"NamePlayer); 
        }
        else
        {
                
Lives[iAttacker] += 1
                 
                if(
iHudsON >= 1
                        
show_hudmessage(iAttacker"[Kill] You've got one live because you killed %s !"NamePlayer); 
        }
        
        if(
Lives[iVictim] > || (Lives[iVictim] >= && cs_get_user_money(iVictim) >= get_pcvar_num(pCvarLifeBuy))) 
                
ClCmdLifeMenu(iVictim); 
         
        return 
HAM_IGNORED
}
         
public 
SaveLives(id
{
        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        new 
VaultKey[64],VaultData[256]; 
         
        
format(VaultKey63"%s-DeathRun-Lives"NamePlayer); 
        
format(VaultData255"%i "Lives[id]); 
         
        
nvault_set(VaultVaultKeyVaultData); 
}
public 
LoadLives(id
{
        new 
NamePlayer[32]; 
        
get_user_name(idNamePlayersizeof(NamePlayer) - 1); 
         
        new 
VaultKey[64], VaultData[256]; 
         
        
format(VaultKeysizeof(VaultKey) - 1"%s-DeathRun-Lives"NamePlayer); 
        
format(VaultDatasizeof(VaultData), "%i "Lives[id]); 
         
        
nvault_get(VaultVaultKeyVaultDatasizeof(VaultData)); 
         
        new 
PlayerLives[32]; 
        
parse(VaultDataPlayerLivessizeof(PlayerLives) - 1); 
         
        
Lives[id] = str_to_num(PlayerLives); 

__________________

❄️ CS Snow Wars - Mod based on snowballs fights
🧟 CS Zombie Panic - A port of HL Zombie Panic!
🎃 CS Halloween Mod - Completely new gamemode for Halloween Holidays
📦 AMXXPack - CLI and build system for amxx projects
🔧 Custom Entities API - API to register custom entities

Last edited by Hedgehog Fog; 04-02-2015 at 10:22.
Hedgehog Fog is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:06.


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