AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved]Compiler Crashes (https://forums.alliedmods.net/showthread.php?t=74365)

grimvh2 07-17-2008 07:36

[solved]Compiler Crashes
 
Hello , when I try to compile this code my compiler just crashes .
No errors ore anything my amxmodx studio just shuts down .

Can someone help me with this cause I find it a little strange .

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>


#define PLUGIN "Another Vip Plugin"
#define VERSION "1.0"
#define AUTHOR "Grim"

#define VIP_ACCES ADMIN_LEVEL_B

/* Pcvars */
new HealthBonus;
new 
KillBonus;
new 
HeadshotBonus;
new 
KillMoney;
new 
HeadshotMoney;
new 
MoneyBonus;
new 
KnifeHealth;

/* Vip Extras */
new sniper[33]
new 
money[33]
new 
grenade[33]
new 
armor[33]
new 
spawnhp[33]
new 
hpknife[33]
new 
killmoney[33]

/* Bools */
new bool:noweapon[33]
new 
bool:used_menu[33]
new 
bool:extra_money[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
/* Log Event */
    
register_logevent("EndRound",2,"0=World triggered""1=Round_Draw""1=Round_End");
    
    
/* Player Spawn */
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
    
/* Pcvars */
    
HealthBonus register_cvar("amx_viphealthbonus""50");
    
KillBonus register_cvar("amx_vipkillbonus""15");
    
HeadshotBonus register_cvar("amx_vipheadshotbonus""20");
    
KillMoney register_cvar("amx_vipkillmoney""500");
    
HeadShotMoney register_cvar("amx_vipheadshotmoney""800");
    
MoneyBonus register_cvar("amx_vipextramoney""1000");
    
KnifeHealth register_cvar("amx_vipknifehealth""400");
    
    
/* Events */
    
register_event("DeathMsg""eDeath""a");
    
register_event("CurWeapon""eWeapon""be");
    
    
/* ConCmds */
    
register_concmd("vipmenu""show_vipmenu"VIP_ACCES);
    
    
    
/* Menu */
    
menu register_menuid("Vip Menu");
    
register_menucmd(menu1023"vipmenu");
}

public 
client_connect(id)
{
    
noweapon[id] = false
    used_menu
[id] = false
}

public 
client_disconnect(id)
{
    
noweapon[id] = false
    used_menu
[id] = false
}

/* Vip Joins */
public client_putinserver(id)
{
    if(
get_user_flags(id) & VIP_ACCES)
    {
        new 
vipname[33]
        
get_user_name(idvipname32)
        
        
set_hudmessage(25500, -1.00.206.06.0)
        
show_hudmessage(id"Special Vip %s has Connected"vipname)
        
        
cs_set_user_vip(id001)
    }
}
        
/* Player Spawn */
public fwHamPlayerSpawnPost(id)
{
    if(
get_user_flags(id) & VIP_ACCES)
    {
        if(
spawnhp[id] > 0)
        {
            new 
viphealth pev(idpev_health)
            new 
viphealthbonus get_pcvar_num(HealthBonus)
            
set_pev(idpev_healthviphealth viphealthbonus)
            
spawnhp[id] = 0
        
}
        
        if(
money[id] > 0)
        {
            new 
vipmoney cs_get_user_money(id)
            new 
vipmoneybonus get_pcvar_num(MoneyBonus)
            
cs_set_user_money(idvipmoney vipmoneybonus)
            
money[id] = 0
        
}
        
        if(
grenade[id] > 0)
        {
            
fm_give_item(idweapon_hegrenade)
            
fm_give_item(idweapon_flashbang)
            
fm_give_item(idweapon_flashbang)
            
fm_give_item(idweapon_smokegrenade)
            
grenade[id] = 0
        
}
        
        if(
hpknife[id] > 0)
        {
            
noweapon[id] = true
            set_task
(0.5"health_knife"id)
            
client_print(idprint_chat"Dont buy , You cant do anything with your weapons!")
            
hpknife[id] = 0
        
}
        
        if(
killmoney[id] > 0)
        {
            
extramoney[id] = true
            killmoney
[id] = 0
        
}
    }
}

/* Round Ends */
public EndRound()
{
    new 
players[32], pnum
    get_players
(playerspnum)
    for( new 
0pnumi++ )
    {
        
noweapon[players[i]] = false
        used_menu
[players[i]] = false
    
}    
}


public 
health_knife(id)
{
    
fm_strip_user_weapons(id)
    
fm_give_item(idknife)
    new 
health get_pcvar_num(HealthKnife)
    
set_pev(idpev_healthhealth)
}

public 
stripandknife(id)
{
    
fm_strip_user_weapons(id)
    
fm_give_item(idknife)
}

/* Someone Died */
public eDeath()
{
    new 
killer read_data(1)
    new 
victem read_data(2)
    new 
headshot read_data(3)
    
    if(
victem killer)
    {
        return 
PLUGIN HANDLED;
    }
    
    if(
get_user_flags(killer) & VIP_ACCES)
    {
        if(
headshot)
        {
            new 
viphealth pev(idpev_health)
            new 
vipheadshotbonus get_pcvar_num(HeadshotBonus)
            
set_pev(idpev_healthviphealth vipheadshotbonus)
            
            if(
extra_money[id])
            {
                new 
bonusmoney get_pcvar_num(HeadshotMoney)
                new 
vipmoney cs_get_user_money(id)
                
cs_set_user_money(idvipmoney bonusmoney)
            }    
        }
        else
        {
            new 
viphealth pev(idpev_health)
            new 
viphealthbonus get_pcvar_num(HealthBonus)
            
set_pev(idpev_healthviphealth viphealthbonus)
            
            if(
extra_money[id])
            {
                new 
bonusmoney get_pcvar_num(KillMoney)
                new 
vipmoney cs_get_user_money(id)
                
cs_set_user_money(idvipmoney bonusmoney)
            }
        }
    }
    return 
PLUGIN_HANDLED;
}

/* Weapon Event */
public eWeapon(id)
{
    if(
noweapon[id])
    {
        new 
clipammoweapon get_user_weapon(idclipammo)
        
        if(
weapon == CSW_KNIFE)
        {
            return 
PLUGIN_HANDLED;
        }
        else
        {
            
set_task(0.1"stripandknife"id)
        }
    }
}

/* Menu */
public show_vipmenu(idlevelcid)
{    
    if (!
cmd_access(id,level,cid,0))
        return 
PLUGIN_HANDLED
    
    
if(used_menu[id])
    {
        
console_print(id"You already picked somthing from the menu this round")
        return 
PLUGIN_HANDLED;
    }
    
    new 
healthbonus get_pcvar_num(HealthBonus)
    new 
knifehealth get_pcvar_num(KnifeHealth)
    
    new 
szBuffer[512], iLen;
 
    
iLen formatex(szBuffersizeof szBuffer 1"\rVip Menu\w^n^n");
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"1. Allow Snipers^n");
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"2. Get +1000$ next round^n");
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"3. Free Granades next Round^n");
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"4. %d extra hp next round^n"healthbonus);
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"5. %dHp Knife only^n^n"knifehealth);
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"6. Extra money for killing^n^n"knifehealth);
    
iLen += formatex(szBuffer[iLen], (sizeof szBuffer 1) - iLen"0. Exit");
 
    new 
iKeys = ( 1<<1<<1<<1<<1<<1<<1<<);
    
show_menu(idiKeysszBuffer, -1"Vip Menu");
}

public 
vipmenu(idkey
{
    switch(
key
    {
        case 
0:
        {
            
/* Allow Sniper */
        
}
        case 
1:
        {
            
money[id]++
            
used_menu[id] = true
            client_print
(idprint_chat"You will receive ectra money on your next spawn")
            return 
PLUGIN_HANDLED
        
}
        case 
2:
        {
            
grenade[id]++
            
used_menu[id] = true
            client_print
(idprint_chat"You will receive free grenades on your next spawn")
            return 
PLUGIN_HANDLED
        
}
        case 
3:
        {
            
spawnhp[id]++
            
used_menu[id] = true
            client_print
(idprint_chat"You will receive extra health on your next spawn")
            return 
PLUGIN_HANDLED
        
}
        case 
4:
        {
            
hpknife[id]++
            
used_menu[id] = true
            
new health get_pcvar_num(KnifeHealth)
            
client_print(idprint_chat"Next spawn you will get %d health and only a knife"health)
            return 
PLUGIN_HANDLED
        
}
        case 
5:
        {
            
killmoney[id]++
            
used_menu[id] = true
            client_print
(idprint_chat"You will receive extra money for killing on your next spawn")
            return 
PLUGIN_HANDLED;
        }
        case 
9:
        {
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_HANDLED



Arkshine 07-17-2008 08:24

Re: Compiler Crashes
 
line 175 : if(victem = killer)

-> if(victem == killer)

jim_yang 07-17-2008 08:38

Re: Compiler Crashes
 
return PLUGIN_HANDLED you miss a '_'

grimvh2 07-17-2008 08:47

Re: Compiler Crashes
 
Thx its back working , I must say you guys have sharp eyes :D

jim_yang 07-17-2008 08:48

Re: [solved]Compiler Crashes
 
arkshine did that, lol, I just looked around line 175, and then...

Arkshine 07-17-2008 09:08

Re: [solved]Compiler Crashes
 
Yep, the crash is because of 'PLUGIN HANDLED' not what I've said, even it's an error, too.

Quote:

I must say you guys have sharp eyes
Not difficult to find out. Just to remove each main function until it doesn't crash, then checking more deeply into the last main function.


All times are GMT -4. The time now is 05:36.

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