Raised This Month: $ Target: $400
 0% 

[ZM 5.x] Save-Ammo on IP (NO MYSQl)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Server Management       
MaXs
Member
Join Date: Jan 2017
Old 01-22-2017 , 14:05   [ZM 5.x] Save-Ammo on IP (NO MYSQl)
Reply With Quote #1

There was one same plugin but with bugs and server crashes.. But this one is fixed and made on IP automatically.

CVARs:
Save-ammo_data_save_type 0 "0/1/2" - saves on name, ip, steamid

0 - name

1 - ip

2 - STEAMID


Save-ammo_show_hp 0 "0/1/2/3" - shows hp when shooting zombie

0 - disable

1 - show hp

2 - show hp + effect

3 - shows when dead


Save-ammo_public 1 "1/0" -

1 - saves

0 - disabled

Ammo_Max
DOWNLOAD
PHP Code:
/*=========================================
            [----->Save-Ammo no mysql [name, ip, steamid]<-----]            
            [Fixed By Max]            
            [v1.1]
Fixed crashes
Auto saves on ip
=========================================*/

#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","0")
    
    
cvar_show_hp register_cvar("Save-ammo_show_hp","3")
    
    
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 /give Name Ammo",arg_name)
            return
        }
        
        if(
equali(name,arg_name))
        {
            
ColorChat(id,GREEN,"[ZP]^x01 /give Name Ammo")
            return
        }
        
        if(
zp_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 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 have ^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_name(id,user_data,63)
        }
        case 
2:
        {
            
get_user_authid(id,user_data,63)
            
format(vaultkey,63,"[aulthid]%s",user_data)
        }
        default:
        {
            
get_user_ip(id,user_data,63)
            
format(vaultkey,63,"[ip]%s",user_data)
        }
    }
    
    
format(vaultdata,255,"%i#%i#",zp_get_user_ammo_packs(id),(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))
    (
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_name(id,user_data,63)
        }
        case 
2:
        {
            
get_user_authid(id,user_data,63)
            
format(vaultkey,63,"[aulthid]%s",user_data)
        }
        default:
        {
            
get_user_ip(id,user_data,63)
            
format(vaultkey,63,"[ip]%s",user_data)
        }
    }
    
    
format(vaultdata,255,"%i#%i#",zp_get_user_ammo_packs(id),(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

Ammo_max.amxx

Last edited by MaXs; 01-22-2017 at 14:07.
MaXs is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 01-22-2017 , 14:44   Re: [ZM 5.x] Save-Ammo on IP (NO MYSQl)
Reply With Quote #2

1) Show default cvars
2) Don't post download links, just upload them at Manage attachments butto'.
3) Don't use PHP Tags on New Plugin Submission, as you say that it's has been fixed.(hadn't test yet)
__________________
Relaxing is offline
MaXs
Member
Join Date: Jan 2017
Old 01-22-2017 , 16:21   Re: [ZM 5.x] Save-Ammo on IP (NO MYSQl)
Reply With Quote #3

Ok sorry, tested its working.
MaXs is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 01-22-2017 , 16:30   Re: [ZM 5.x] Save-Ammo on IP (NO MYSQl)
Reply With Quote #4

remove .amxx file and attach the .sma file it's the rules.
https://forums.alliedmods.net/showthread.php?t=21956
yas17sin is offline
Send a message via ICQ to yas17sin
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-22-2017 , 17:07   Re: [ZM 5.x] Save-Ammo on IP (NO MYSQl)
Reply With Quote #5

1. ZP plugins belong to the ZP sub-forum.
2. Saving on Name/IP is wrong.
3. There's a lot better Ammo saving plugins around.

Just trash this already.
__________________
edon1337 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 12:33.


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