Raised This Month: $12 Target: $400
 3% 

Vip plugin - server crah plz help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
noname456
Junior Member
Join Date: Feb 2009
Old 06-30-2009 , 07:23   Vip plugin - server crah plz help
Reply With Quote #1

Hello, I am donwloaded Zm Vip plugin, but this plugin makes me server crash. Its working, but... Can anyone find the problem?

Here Codes:

Quote:
/* Script generated by Pawn Studio */
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <engine>
#include <fakemeta_util>
#define PLUGIN "ZM VIP"
#define AUTHOR "aaarnas"
#define VERSION "1.2a"
#define ADMINACCESS ADMIN_LEVEL_H
static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
const g_armor_amount = 100
new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" }
new bool:dojump[33] = false
new jumpnum[33] = 0
new gmsgSayText
new ammo
new maxplayers
new health
new add_health
new hp_max
new killer_hp
new infect_ammo
new const
VIP_STATUS[] = "Prisijunge Vipai",
VIP_STATUS_N[] = "Nera prisijungusiu Vipu",
CONTACT_ADMIN[] = "";

public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg","death_msg","a")
register_logevent("logevent_Round_Start", 2, "1=Round_Start")
register_clcmd("say", "handle_say")
register_clcmd("say /wantvip","ShowMotd")
register_clcmd("say /vip","ShowMotd")

register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
register_cvar("vip_multijump", "2")
ammo = register_cvar("vip_kill_ammo","4")
health = register_cvar("vip_hp_on_infect", "500")
infect_ammo = register_cvar("vip_ammo_on_infect", "3")

gmsgSayText = get_user_msgid("SayText")
maxplayers = get_maxplayers()
}
public death_msg() {

if(read_data(1)<=maxplayers && read_data(1) && read_data(1)!=read_data(2)) zp_set_user_ammo_packs(read_data(1),zp_get_us er_ammo_packs(read_data(1)) + get_pcvar_num(ammo))
}
public client_putinserver(id)
{
jumpnum[id] = 0
dojump[id] = false
}
public client_disconnect(id)
{
jumpnum[id] = 0
dojump[id] = false
}
public zp_user_infected_post(player, infector) {

add_health = get_pcvar_num(health)
hp_max = zp_get_zombie_maxhealth(infector)
if(!(get_user_flags(infector) & ADMINACCESS) && !is_user_alive(infector))
return;

killer_hp = get_user_health(infector)
killer_hp += add_health
if (killer_hp > hp_max) killer_hp = hp_max
fm_set_user_health(infector, killer_hp);
zp_set_user_ammo_packs(infector, zp_get_user_ammo_packs(infector) + get_pcvar_num(infect_ammo))
}
public handle_say(id) {
new said[192]
read_args(said,192)
if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/vips") != -1 )
set_task(0.1,"print_adminlist",id)
return PLUGIN_CONTINUE
}
public logevent_Round_Start()
{
for(new i=0; i<= maxplayers; i++) {
if (get_user_flags(i) & ADMINACCESS) {
set_pev(i, pev_armorvalue, float(pev(i, pev_armorvalue)+g_armor_amount))
engfunc(EngFunc_EmitSound, i, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
}

public print_adminlist(user)
{
new adminnames[33][32]
new message[256]
new contactinfo[256], contact[112]
new id, count, x, len

for(id = 1 ; id <= maxplayers ; id++)
if(is_user_connected(id))
if(get_user_flags(id) & ADMINACCESS)
get_user_name(id, adminnames[count++], 31)
len = format(message, 255, "%s%s: ",COLOR, VIP_STATUS)
if(count > 0) {
for(x = 0 ; x < count ; x++) {
len += format(message[len], 255-len, "%s%s", adminnames[x], x < (count-1) ? ", ":"")
if(len > 96 ) {
print_message(user, message)
len = format(message, 255, "%s",COLOR)
}
}
print_message(user, message)
}
else {
len += format(message[len], 255-len, "%s.", VIP_STATUS_N)
print_message(user, message)
}

get_cvar_string("amx_contactinfo", contact, 63)
if(contact[0]) {
format(contactinfo, 111, "", COLOR, CONTACT_ADMIN, contact)
print_message(user, contactinfo)
}
}
print_message(id, msg[]) {
message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}
public client_PreThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(!access(id,ADMINACCESS)) return PLUGIN_CONTINUE
new nbut = get_user_button(id)
new obut = get_user_oldbutton(id)
if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
{
if(jumpnum[id] < get_cvar_num("vip_multijump"))
{
dojump[id] = true
jumpnum[id]++
return PLUGIN_CONTINUE
}
}
if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpnum[id] = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(!access(id,ADMINACCESS)) return PLUGIN_CONTINUE
if(dojump[id] == true)
{
new Float:velocity[3]
entity_get_vector(id,EV_VEC_velocity,velocity )
velocity[2] = random_float(265.0,285.0)
entity_set_vector(id,EV_VEC_velocity,velocity )
dojump[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public ShowMotd(id)
{
show_motd(id, "vip.txt")
}
Sorry, i am new here...
noname456 is offline
johnjg75
Veteran Member
Join Date: Mar 2004
Location: Delaware
Old 07-03-2009 , 10:32   Re: Vip plugin - server crah plz help
Reply With Quote #2

I haven't looked too much into it but i can suggest that you use read_data(1) once and store it in a variable so you dont keep calling that command.
__________________
johnjg75 is offline
Send a message via AIM to johnjg75 Send a message via MSN to johnjg75 Send a message via Yahoo to johnjg75
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 07-28-2009 , 06:16   Re: Vip plugin - server crah plz help
Reply With Quote #3

Quote:
Originally Posted by johnjg75 View Post
I haven't looked too much into it but i can suggest that you use read_data(1) once and store it in a variable so you dont keep calling that command.
Thanks

PHP Code:
public death_msg() {
    
    new 
attacker read_data(1)
    if(
get_user_flags(attacker) & ADMINACCESS && attacker<=maxplayers && attacker && attacker!=read_data(2)) zp_set_user_ammo_packs(attacker,zp_get_user_ammo_packs(attacker) + get_pcvar_num(ammo))

Do you see anything more?
aaarnas is offline
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 07-28-2009 , 06:19   Re: Vip plugin - server crah plz help
Reply With Quote #4

This is current version:
PHP Code:

/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <zombieplague>

#define PLUGIN    "ZM VIP"
#define AUTHOR    "aaarnas"
#define VERSION    "1.2b"

#define ADMINACCESS ADMIN_LEVEL_H

static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
new bool:dojump[33] = false;
new 
jumpnum[33] = 0;
new 
g_vip_armor
//new g_menu
//new g_menu_delay
//new g_vip_gravity
//new g_vip_speed
new gmsgSayText
new ammo
new maxplayers
new health_add
new nKiller_hp
new nHp_add
new nHp_max

new const
    
VIP_STATUS[] = "Prisijunge VIP:",
    
VIP_STATUS_N[] = "Nera prisijungusiu VIP",
    
CONTACT_ADMIN[] = "Serverio Administratoriaus kontaktai";
    
public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg","death_msg","a")
    
register_logevent("logevent_Round_Start"2"1=Round_Start")
    
register_clcmd("say""handle_say")
    
register_clcmd("say /noriuvip","ShowMotd")
    
register_clcmd("say /wantvip","ShowMotd")
    
register_clcmd("say /vip","ShowMotd")
//    register_clcmd("say /vm", "Menu")
//    register_clcmd("say /vipmenu", "Menu")
    
    
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
    
register_cvar("vip_multijump""2")
    
ammo register_cvar("vip_kill_ammo","4")
    
health_add register_cvar("vip_hp_on_infect""500")
    
g_vip_armor register_cvar("vip_armor""1")
//    g_menu = register_cvar("vip_menu", "3")
//    g_menu_delay = register_cvar("vip_menu_delay", "5.0")
//    g_vip_gravity = register_cvar("vip_gravity", "500.0")
//    g_vip_speed = register_cvar("vip_speed", "280.0")
    
    
gmsgSayText get_user_msgid("SayText")
    
maxplayers get_maxplayers()
}

public 
death_msg() {
    
    new 
attacker read_data(1)
    if(
get_user_flags(attacker) & ADMINACCESS && attacker<=maxplayers && attacker && attacker!=read_data(2)) zp_set_user_ammo_packs(attacker,zp_get_user_ammo_packs(attacker) + get_pcvar_num(ammo))
}

public 
client_putinserver(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}

public 
client_disconnect(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}

public 
zp_user_infected_post(playerinfector)
{
    
nHp_add get_pcvar_num (health_add)
    
nHp_max zp_get_zombie_maxhealth(infector)
    if(!(
get_user_flags(infector) & ADMIN_LEVEL_H))
    return;
    
    
nKiller_hp get_user_health(infector)
    
nKiller_hp += nHp_add
    
if (nKiller_hp nHp_maxnKiller_hp nHp_max
    fm_set_user_health
(infectornKiller_hp)
 
}

public 
handle_say(id) {
    new 
said[192]
    
read_args(said,192)
    if( ( 
containi(said"who") != -&& containi(said"admin") != -) || contain(said"/vips") != -)
        
set_task(0.1,"print_adminlist",id)
    return 
PLUGIN_CONTINUE
}

public 
logevent_Round_Start()
{
    if(
g_vip_armor) {
    new 
players[32], idpnum;
    
get_players(playerspnum"a");
    for(new 
i=0i<= pnumi++) {        
        
id players[i];
        if(
get_user_flags(id) & ADMINACCESS && get_pcvar_num(g_vip_armor) == 1) {
            
// Kolkas naudosių šį šarvų būdą.
            
fm_give_item(id"item_kevlar");
            
fm_give_item(id"item_assaultsuit");
        
//    if(g_menu || get_pcvar_num(g_menu) == 3) set_task(get_pcvar_float(g_menu_delay), "Menu", id)
            
}
        }
    }
    return 
PLUGIN_HANDLED
}


public 
print_adminlist(user
{
    new 
adminnames[33][32]
    new 
message[256]
    new 
contactinfo[256], contact[112]
    new 
idcountxlen
    
    
for(id id <= maxplayers id++)
        if(
is_user_connected(id))
            if(
get_user_flags(id) & ADMINACCESS)
                
get_user_name(idadminnames[count++], 31)

    
len format(message255"%s %s: ",COLORVIP_STATUS)
    if(
count 0) {
        for(
count x++) {
            
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
            if(
len 96 ) {
                
print_message(usermessage)
                
len format(message255"%s ",COLOR)
            }
        }
        
print_message(usermessage)
    }
    else {
        
len += format(message[len], 255-len"%s."VIP_STATUS_N)
        
print_message(usermessage)
    }
    
    
get_cvar_string("amx_contactinfo"contact63)
    if(
contact[0])  {
        
format(contactinfo111"%s %s -- %s"COLORCONTACT_ADMINcontact)
        
print_message(usercontactinfo)
    }
}

print_message(idmsg[]) {
    
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
    
write_byte(id)
    
write_string(msg)
    
message_end()
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
if(!access(id,ADMINACCESS)) return PLUGIN_CONTINUE
    
new nbut get_user_button(id)
    new 
obut get_user_oldbutton(id)
    if((
nbut IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut IN_JUMP))
    {
        if(
jumpnum[id] < get_cvar_num("vip_multijump"))
        {
            
dojump[id] = true
            jumpnum
[id]++
            return 
PLUGIN_CONTINUE
        
}
    }
    if((
nbut IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    {
        
jumpnum[id] = 0
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_PostThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
if(!access(id,ADMINACCESS)) return PLUGIN_CONTINUE
    
if(dojump[id] == true)
    {
        new 
Float:velocity[3]    
        
entity_get_vector(id,EV_VEC_velocity,velocity)
        
velocity[2] = random_float(265.0,285.0)
        
entity_set_vector(id,EV_VEC_velocity,velocity)
        
dojump[id] = false
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}    

public 
ShowMotd(id)
{
 
show_motd(id"vip.txt")

aaarnas is offline
Armin
Junior Member
Join Date: Feb 2010
Location: Estonia
Old 02-21-2010 , 06:39   Re: Vip plugin - server crah plz help
Reply With Quote #5

Is it working? My server crashes..
__________________
Armin is offline
Send a message via ICQ to Armin
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 22:47.


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