Raised This Month: $32 Target: $400
 8% 

I want to save lives in my DR server. PLS HELP


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ASUS_BG
Junior Member
Join Date: Jun 2010
Old 01-01-2011 , 11:02   I want to save lives in my DR server. PLS HELP
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <zombieplague>

/*START - From colorchat.inc by Numb */
enum Color {
    
NORMAL 1,
    
GREEN,
    
TEAM_COLOR,
    
GREY,
    
RED,
    
BLUE,
}

new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}
/*END - From colorchat.inc by Numb */

new data_vault,
cvar_data_save_typecvar_show_hpcvar_give_ammo_publiccvar_ammo_limit
public plugin_init() {
    
register_plugin("[ZP] Save-ammo by GM""1.5""GM")
    
register_cvar("Save-ammo_version","1.4",FCVAR_SERVER FCVAR_SPONLY)
    
    
register_clcmd("say","hook_say")
    
register_clcmd("say_team","hook_say")
    
    
register_event("Damage","event_damage","b","2!0","3=0","4!0"
    
    
cvar_data_save_type register_cvar("Save-ammo_data_save_type","1")
    
    
cvar_show_hp register_cvar("Save-ammo_show_hp","0")
    
    
cvar_give_ammo_public register_cvar("Save-ammo_public","1")
    
    
cvar_ammo_limit register_cvar("Save-ammo_limit","0")
    
    
data_vault nvault_open("Save-ammo")
}

public 
hook_say(id)
{
    new 
args[129], arg_cmd[6],arg_name[32],arg_ap[10]
    
read_args(args,128)
    
remove_quotes(args)
    
parse(argsarg_cmd,5arg_name,31arg_ap,9)
    
    if(
equali(arg_cmd,"/give"))
    {
        new 
name[32],target_name[32],targetnum_ap str_to_num(arg_ap)
        
get_user_name(id,name,31)
        
target cmd_target(id,arg_name,0)
        
get_user_name(target,target_name,31)
        
        if(!
target)
        {
            
ColorChat(id,GREEN,"[ZP]^x01 can't find player with that name ^x04%s^x01 .",arg_name)
            return
        }
        
        if(
equali(name,arg_name))
        {
            
ColorChat(id,GREEN,"[ZP]^x01 you can't give yourself.")
            return
        }
        
        if(
zp_get_user_ammo_packs(id) < num_ap)
        {
            
ColorChat(id,GREEN,"[ZP]^x01 you don't have ammo packs to give.")
            return
        }
        
        if(
num_ap <= 0)
        {
            
ColorChat(id,GREEN,"[ZP]^x01 you can only give the ammo pack from 1 to 10000.")
            return
        }
        
        
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) - num_ap)
        
zp_set_user_ammo_packs(targetzp_get_user_ammo_packs(target) + num_ap)
        
        
ColorChat(id,GREEN,"[ZP]^x01 you gave  ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
        
ColorChat(target,GREEN,"[ZP] %s^x01 you received ^x04%s^x01 ammo packs.",name,arg_ap)
        
        if(
get_pcvar_num(cvar_give_ammo_public)) ColorChat(0,GREEN,"[ZP] %s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
    }
    
    if(
equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 you have  ^x04%i^x01 ammo packs.",zp_get_user_ammo_packs(id))
}

public 
event_damage(id)
{
    new 
killer,hp
    killer 
get_user_attacker(id)
    
hp get_user_health(id)
    
    if(!
is_user_connected(killer) || !is_user_connected(id)) return
    
    if(
hp 0)
    {
        switch(
get_pcvar_num(cvar_show_hp))
        {
            case 
1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
            case 
2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
            case 
3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
        }
    } else {
        switch(
get_pcvar_num(cvar_show_hp))
        {
            case 
1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"KILLED!")
            case 
2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
            case 
3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
        }
    }
}

public 
client_putinserver(id)
{
    
set_task(1.0,"load_user_data",id)
}

public 
client_disconnect(id)
{
    
save_user_data(id)
}

public 
load_user_data(id)
{
    if(!
is_user_connected(id)) return
    
    new 
user_data[64], vaultkey[64],vaultdata[256], data_ammo_packs[32],data_zombie_class[32]
    
    switch(
get_pcvar_num(cvar_data_save_type))
    {
        case 
1:
        {
            
get_user_ip(id,user_data,63)
            
format(vaultkey,63,"[ip]%s",user_data)
        }
        case 
2:
        {
            
get_user_authid(id,user_data,63)
            
format(vaultkey,63,"[aulthid]%s",user_data)
        }
        default:
        {
            
get_user_name(id,user_data,63)
            
format(vaultkey,63,"[name]%s",user_data)
        }
    }
    
    
format(vaultdata,255,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
    
nvault_get(data_vault,vaultkey,vaultdata,255)
    
replace_all(vaultdata,255,"#"," ")
    
    
parse(vaultdatadata_ammo_packs,31data_zombie_class,31)
    
zp_set_user_ammo_packs(idstr_to_num(data_ammo_packs))
    
zp_set_user_zombie_class(idstr_to_num(data_zombie_class))
    
    if(
get_pcvar_num(cvar_ammo_limit) != && zp_get_user_ammo_packs(id) > get_pcvar_num(cvar_ammo_limit)) zp_set_user_ammo_packs(id,get_pcvar_num(cvar_ammo_limit))
}

public 
save_user_data(id)
{
    new 
user_data[64], vaultkey[64],vaultdata[256]
    
    switch(
get_pcvar_num(cvar_data_save_type))
    {
        case 
1:
        {
            
get_user_ip(id,user_data,63)
            
format(vaultkey,63,"[ip]%s",user_data)
        }
        case 
2:
        {
            
get_user_authid(id,user_data,63)
            
format(vaultkey,63,"[aulthid]%s",user_data)
        }
        default:
        {
            
get_user_name(id,user_data,63)
            
format(vaultkey,63,"[name]%s",user_data)
        }
    }
    
    
format(vaultdata,255,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
    
nvault_set(data_vault,vaultkey,vaultdata)
}

/*START - From colorchat.inc by Numb */
ColorChat(idColor:type, const msg[], {FloatSqlResult,_}:...) {
    new 
message[256]

    switch(
type) {
        case 
NORMALmessage[0] = 0x01
        
case GREENmessage[0] = 0x04
        
default: message[0] = 0x03
    
}

    
vformat(message[1], 251msg4)

    
message[192] = '^0'

    
new teamColorChangeindexMSG_Type

    
if(id) {
        
MSG_Type MSG_ONE
        index 
id
    
} else {
        
index FindPlayer()
        
MSG_Type MSG_ALL
    
}

    
team get_user_team(index)
    
ColorChange ColorSelection(indexMSG_Typetype)

    
ShowColorMessage(indexMSG_Typemessage)

    if(
ColorChange)
        
Team_Info(indexMSG_TypeTeamName[team])
}

ShowColorMessage(idtypemessage[]) {
    static 
bool:saytext_used
    
static get_user_msgid_saytext

    
if(!saytext_used) {
        
get_user_msgid_saytext get_user_msgid("SayText")
        
saytext_used true
    
}

    
message_begin(typeget_user_msgid_saytext_id)
    
write_byte(id)
    
write_string(message)
    
message_end()
}

Team_Info(idtypeteam[]) {
    static 
bool:teaminfo_used
    
static get_user_msgid_teaminfo

    
if(!teaminfo_used) {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo")
        
teaminfo_used true
    
}

    
message_begin(typeget_user_msgid_teaminfo_id)
    
write_byte(id)
    
write_string(team)
    
message_end()

    return 
1
}

ColorSelection(indextypeColor:Type) {
    switch(
Type) {
        case 
RED: return Team_Info(indextypeTeamName[1])
        case 
BLUE: return Team_Info(indextypeTeamName[2])
        case 
GREY: return Team_Info(indextypeTeamName[0])
    }

    return 
0
}

FindPlayer() {
    new 
= -1

    
while(<= get_maxplayers()) {
        if(
is_user_connected(++i))
            return 
i
    
}

    return -
1
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1026\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by ASUS_BG; 01-10-2011 at 19:25.
ASUS_BG is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 01-01-2011 , 13:21   Re: I want to save lives in my DR server. PLS HELP
Reply With Quote #2

Quote:
Originally Posted by ASUS_BG View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>

/*START - From colorchat.inc by Numb */
enum Color {
    
NORMAL 1,
    
GREEN,
    
TEAM_COLOR,
    
GREY,
    
RED,
    
BLUE,
}

new 
TeamName[][] = {
    
"",
    
"TERRORIST",
    
"CT",
    
"SPECTATOR"
}
/*END - From colorchat.inc by Numb */

new data_vault,
cvar_data_save_typecvar_give_ammo_publiccvar_ammo_limit
public plugin_init() {
    
register_plugin("[ZP] Save-ammo by GM""1.5""GM")
    
register_cvar("Save-ammo_version","1.4",FCVAR_SERVER FCVAR_SPONLY)
    
    
register_clcmd("say","hook_say")
    
register_clcmd("say_team","hook_say")
    
    
register_event("Damage","event_damage","b","2!0","3=0","4!0"
    
    
cvar_data_save_type register_cvar("Save-ammo_data_save_type","1")
    
    
cvar_give_ammo_public register_cvar("Save-ammo_public","1")
    
    
cvar_ammo_limit register_cvar("Save-ammo_limit","0")
    
    
data_vault nvault_open("Save-ammo")
}

public 
hook_say(id)
{
    new 
args[129], arg_cmd[6],arg_name[32],arg_ap[10]
    
read_args(args,128)
    
remove_quotes(args)
    
parse(argsarg_cmd,5arg_name,31arg_ap,9)
    
    if(
equali(arg_cmd,"/give"))
    {
        new 
name[32],target_name[32],targetnum_ap str_to_num(arg_ap)
        
get_user_name(id,name,31)
        
target cmd_target(id,arg_name,0)
        
get_user_name(target,target_name,31)
        
        if(!
target)
        {
            
ColorChat(id,GREEN,"[ZP]^x01 nemo6e da se nameri igra4 s tova ima ^x04%s^x01 .",arg_name)
            return
        }
        
        if(
equali(name,arg_name))
        {
            
ColorChat(id,GREEN,"[ZP]^x01 vie nemo6e da dadete na ebe si.")
            return
        }
        
        if(
get_user_ammo_packs(id) < num_ap)
        {
            
ColorChat(id,GREEN,"[ZP]^x01 vie nqmate ammota za da dadete.")
            return
        }
        
        if(
num_ap <= 0)
        {
            
ColorChat(id,GREEN,"[ZP]^x01 vie mo6e da davate samo polo6itelni ammota ot 1-10000.")
            return
        }
        
        
set_user_ammo_packs(idget_user_ammo_packs(id) - num_ap)
        
set_user_ammo_packs(targetget_user_ammo_packs(target) + num_ap)
        
        
ColorChat(id,GREEN,"[ZP]^x01 vie dadohte  ^x04%s^x01 ammo packs na ^x04%s^x01.",arg_ap,target_name)
        
ColorChat(target,GREEN,"[ZP] %s^x01 vie polu4ihte ^x04%s^x01 ammo packs.",name,arg_ap)
        
        if(
get_pcvar_num(cvar_give_ammo_public)) ColorChat(0,GREEN,"[ZP] %s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
    }
    
    if(
equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 vie imate  ^x04%i^x01 ammo packs.",get_user_ammo_packs(id))
}

public 
client_putinserver(id)
{
    
set_task(1.0,"load_user_data",id)
}

public 
client_disconnect(id)
{
    
save_user_data(id)
}

public 
load_user_data(id)
{
    if(!
is_user_connected(id)) return
    
    new 
user_data[64], vaultkey[64],vaultdata[256], data_ammo_packs[32]
    
    switch(
get_pcvar_num(cvar_data_save_type))
    {
        case 
1:
        {
            
get_user_ip(id,user_data,63)
            
format(vaultkey,63,"[ip]%s",user_data)
        }
        case 
2:
        {
            
get_user_authid(id,user_data,63)
            
format(vaultkey,63,"[aulthid]%s",user_data)
        }
        default:
        {
            
get_user_name(id,user_data,63)
            
format(vaultkey,63,"[name]%s",user_data)
        }
    }
    
    
format(vaultdata,255,"%i#%i#",get_user_ammo_packs(id))
    
nvault_get(data_vault,vaultkey,vaultdata,255)
    
replace_all(vaultdata,255,"#"," ")
    
    
parse(vaultdatadata_ammo_packs,31)
    
set_user_ammo_packs(idstr_to_num(data_ammo_packs))
    
    if(
get_pcvar_num(cvar_ammo_limit) != && get_user_ammo_packs(id) > get_pcvar_num(cvar_ammo_limit)) set_user_ammo_packs(id,get_pcvar_num(cvar_ammo_limit))
}

public 
save_user_data(id)
{
    new 
user_data[64], vaultkey[64],vaultdata[256]
    
    switch(
get_pcvar_num(cvar_data_save_type))
    {
        case 
1:
        {
            
get_user_ip(id,user_data,63)
            
format(vaultkey,63,"[ip]%s",user_data)
        }
        case 
2:
        {
            
get_user_authid(id,user_data,63)
            
format(vaultkey,63,"[aulthid]%s",user_data)
        }
        default:
        {
            
get_user_name(id,user_data,63)
            
format(vaultkey,63,"[name]%s",user_data)
        }
    }
    
    
format(vaultdata,255,"%i#%i#",get_user_ammo_packs(id))
    
nvault_set(data_vault,vaultkey,vaultdata)
}

/*START - From colorchat.inc by Numb */
ColorChat(idColor:type, const msg[], {FloatSqlResult,_}:...) {
    new 
message[256]

    switch(
type) {
        case 
NORMALmessage[0] = 0x01
        
case GREENmessage[0] = 0x04
        
default: message[0] = 0x03
    
}

    
vformat(message[1], 251msg4)

    
message[192] = '^0'

    
new teamColorChangeindexMSG_Type

    
if(id) {
        
MSG_Type MSG_ONE
        index 
id
    
} else {
        
index FindPlayer()
        
MSG_Type MSG_ALL
    
}

    
team get_user_team(index)
    
ColorChange ColorSelection(indexMSG_Typetype)

    
ShowColorMessage(indexMSG_Typemessage)

    if(
ColorChange)
        
Team_Info(indexMSG_TypeTeamName[team])
}

ShowColorMessage(idtypemessage[]) {
    static 
bool:saytext_used
    
static get_user_msgid_saytext

    
if(!saytext_used) {
        
get_user_msgid_saytext get_user_msgid("SayText")
        
saytext_used true
    
}

    
message_begin(typeget_user_msgid_saytext_id)
    
write_byte(id)
    
write_string(message)
    
message_end()
}

Team_Info(idtypeteam[]) {
    static 
bool:teaminfo_used
    
static get_user_msgid_teaminfo

    
if(!teaminfo_used) {
        
get_user_msgid_teaminfo get_user_msgid("TeamInfo")
        
teaminfo_used true
    
}

    
message_begin(typeget_user_msgid_teaminfo_id)
    
write_byte(id)
    
write_string(team)
    
message_end()

    return 
1
}

ColorSelection(indextypeColor:Type) {
    switch(
Type) {
        case 
RED: return Team_Info(indextypeTeamName[1])
        case 
BLUE: return Team_Info(indextypeTeamName[2])
        case 
GREY: return Team_Info(indextypeTeamName[0])
    }

    return 
0
}

FindPlayer() {
    new 
= -1

    
while(<= get_maxplayers()) {
        if(
is_user_connected(++i))
            return 
i
    
}

    return -
1
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1026\\ f0\\ fs16 \n\\ par }
*/ 
Cool. Wait.. what do you want exactly?
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 01-01-2011 , 13:23   Re: I want to save lives in my DR server. PLS HELP
Reply With Quote #3

Quote:
Originally Posted by ASUS_BG View Post
I want to save lives
Cool !
Thnx for providing so much useful description
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
marquezs
Member
Join Date: Jun 2010
Old 01-01-2011 , 20:56   Re: I want to save lives in my DR server. PLS HELP
Reply With Quote #4

He wants you to modify the plugin so that it saves lifes or lives.

The plugin that gives lives to players is the DeathRun Manager by Xpaw... he wanted a bank like this in zp to save the lifes given by deathrun manager
marquezs is offline
ASUS_BG
Junior Member
Join Date: Jun 2010
Old 01-10-2011 , 19:28   Re: I want to save lives in my DR server. PLS HELP
Reply With Quote #5

Exactly. If you can plss help

Last edited by ASUS_BG; 01-11-2011 at 15:50.
ASUS_BG is offline
Reply


Thread Tools
Display Modes

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 20:58.


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