AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin Error (https://forums.alliedmods.net/showthread.php?t=210530)

razermamba 03-11-2013 12:06

Plugin Error
 
Hi all. I have hosting server running on linux. I made plugin and it should work cause I have tested it on my LAN server and it worked great. The main problem is that when I run server, it shows this in console and server stop:

MasterRequestRestart
Your server needs to be restarted in order to receive the latest update.
Uploading dump (in-process) [proxy '']
/tmp/dumps/crash_20130311170216_1.dmp
success = no
error: Failed to open/read local data from file/application
Segmentation fault

Server is updated. I wrote to support and they told me that it is caused by my plugin. Without plugin server works. Please help me. Thx
P.S: Pleae do not write sentences like "Oh it is bad coded etc.". I have not done optimalizations yet.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <engine>
#include <playermodel>

#define PLUGIN "Umbrella Swarm RELOADED"
#define VERSION "1.0"
#define AUTHOR "P.72 Dragon"

#define HIDE_FLASH            (1<<1)    //flashlight, +
#define HIDE_HP_HUD        (1<<3)    //Health, armour and radar
#define HIDE_MONEY            (1<<5)    //money, +
#define TASKID_HUD    2931

new const g_hunterleap[] = "umbrella/hunter_leap.wav"  

new const ZOMBIE_MODEL [] = "models/player/hunter/hunter.mdl";

new const 
g_ZombieClaws[] = "models/v_hunter_knife.mdl";

new const 
g_sound_zombiewin[] = "umbrella/zombiewin.wav";
new const 
g_sound_humanwin[] = "umbrella/humanwin.wav";

new 
boolg_bFreezeTime;

new const 
g_sound_miss[][]=
{
    
"Left4Dead/Hunter_miss1.wav",
    
"Left4Dead/Hunter_miss2.wav",
    
"Left4Dead/Hunter_miss3.wav"
};

new const 
g_sound_hit[][]=
{
    
"Left4Dead/Hunter_strike1.wav",
    
"Left4Dead/Hunter_strike2.wav",
    
"Left4Dead/Hunter_strike3.wav"
};

new const 
g_sound_pain[][]=
{
    
"Left4Dead/Hunter_pain1.wav",
    
"Left4Dead/Hunter_pain2.wav",
    
"Left4Dead/Hunter_pain3.wav"
};

new const 
g_sound_die[][]=
{
    
"Left4Dead/Hunter_die1.wav",
    
"Left4Dead/Hunter_die2.wav"
};

new 
g_Zombie[33]
new 
g_SpawnOn[33]
new 
msg_hideweapon
new g_hudsync
new boolg_hasLeap[33]
new 
Floatg_LastLeap[33]

new 
cvar_healthcvar_armorcvar_gravitycvar_speedcvar_respawncvar_switchcvar_semiclip,
cvar_semiclip_tcvar_semiclip_ctcvar_Leapcvar_LeapCooldowncvar_LeapForcecvar_LeapHeight;

public 
plugin_precache()
{
    
precache_model(ZOMBIE_MODEL)
    
/*for(new i = 0; i < sizeof ZOMBIE_MODEL; i++)
    {
        new modelpath[256];
        formatex( modelpath, 255, "models/player/%s/%s.mdl", ZOMBIE_MODEL[i], ZOMBIE_MODEL[i] );
        precache_model(modelpath);
    }*/
    
    
new i;
    for(
0sizeof g_sound_diei++)
        
engfunc(EngFunc_PrecacheSoundg_sound_die[i]);
    for(
0sizeof g_sound_hiti++)
        
engfunc(EngFunc_PrecacheSoundg_sound_hit[i]);    
    for(
0sizeof g_sound_missi++)
        
engfunc(EngFunc_PrecacheSoundg_sound_miss[i]);    
    for(
0sizeof g_sound_paini++)
        
engfunc(EngFunc_PrecacheSoundg_sound_pain[i]);        
    
    
    
precache_model(g_ZombieClaws);
    
    
precache_sound(g_sound_zombiewin);
    
precache_sound(g_sound_humanwin);
    
precache_sound(g_hunterleap);
}


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
cvar_Leap register_cvar("zswarm_leap""1");
    
cvar_LeapCooldown register_cvar("zswarm_cooldown","5.0");
    
cvar_LeapForce register_cvar("zswarm_lforce""525");
    
cvar_LeapHeight register_cvar("zswarm_lheight""260");
    
    
cvar_health register_cvar ("us_health""600");
    
cvar_armor register_cvar ("us_armor""200");
    
cvar_gravity register_cvar ("us_gravity""0.75");
    
cvar_speed register_cvar ("us_speed""300.0");
    
cvar_respawn register_cvar("us_respawn""3");
    
cvar_switch register_cvar("us_switch""3");
    
cvar_semiclip register_cvar("us_noclip""1");
    
cvar_semiclip_t register_cvar("us_noclip_t""0");
    
cvar_semiclip_ct register_cvar("us_noclip_ct""1");
    
    
g_hudsync        =    CreateHudSyncObj()
    
    
RegisterHam(Ham_Spawn"player""PlayerSpawn"1);
    
RegisterHam(Ham_Item_PreFrame"player""ResetMaxSpeed"1)
    
    
register_forward(FM_EmitSound"EmitSound");
    
register_forward(FM_Touch"EnityTouch");
    
register_forward(FM_CmdStart"Forward_CmdStart");
    
    
register_event("CurWeapon""CurrentWeapon""be""1=1");
    
register_event("DeathMsg""Event_DeathMessage""b");
    
register_logevent("RoundEnd"2"1=Round_End");
    
    
msg_hideweapon    =     get_user_msgid("HideWeapon")
    
register_message(get_user_msgid("SendAudio"), "Message_SendAudio");
}

public 
client_connect(id)
{
    
g_hasLeap[id] = false
}

public 
PlayerSpawn(id)
{
    if(!
is_user_alive(id))
        return;    
    
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        new 
HealthArmorFloatGravity
        
        Health 
get_pcvar_num(cvar_health);
        
Armor get_pcvar_num(cvar_armor);
        
Gravity get_pcvar_float(cvar_gravity);
        
        
g_Zombie[id] = true
        
        set_pev
(idpev_healthfloat(Health));
        
cs_set_user_armor(idArmorCS_ARMOR_VESTHELM);
        
set_pev(idpev_gravityGravity);
        
        
g_hasLeap[id] = true;
        
        
fm_set_user_model(idZOMBIE_MODELtrue)
                
        if(!
cs_get_user_nvg(id))
            
cs_set_user_nvg(id);
        
        
set_task(0.2"Task_HUD"TASKID_HUD id)
    }
    
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        
g_Zombie[id] = false
        set_pev
(idpev_health100.0);
    }
}

public 
ResetMaxSpeed(id)
{
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
    {
        new 
FloatSpeed
        Speed 
get_pcvar_float(cvar_speed)
        
entity_set_float(idEV_FL_maxspeedSpeed)
    }
}

public 
Forward_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;


    static 
FloatflTime flTime get_gametime();
    
    static 
iButton iButton get_uc(uc_handleUC_Buttons );
    
    static 
fViewAngles[3] ; get_uc(uc_handleUC_ViewAnglesfViewAngles);

    
    static 
iFlag iFlag entity_get_int(idEV_INT_flags);

    static 
aimbodyszAimingEnt[32];
    
get_user_aiming(idaimbody60);
    
entity_get_string(aimEV_SZ_classnameszAimingEntcharsmax(szAimingEnt));
    
    if (
g_Zombie[id])
    {
        if (!
g_bFreezeTime && (iButton IN_ATTACK) && (iButton IN_DUCK) && (iFlag FL_ONGROUND))
        {
            if (
get_pcvar_num(cvar_Leap))
            {
                static 
Floatfl_CoolDown fl_CoolDown get_pcvar_float(cvar_LeapCooldown);
                {
                    if(
flTime fl_CoolDown g_LastLeap[id])
                    {
                        
clcmd_leap(id);
                        
g_LastLeap[id] = flTime;
                    }
                }
            }
        }
    }
    return 
FMRES_IGNORED
}

public 
clcmd_leap(id)
{
    new 
Floatvelocity[3];
    new 
Floatlheightlforce;
    
lforce get_pcvar_num(cvar_LeapForce);
    
lheight get_pcvar_float(cvar_LeapHeight);

    
velocity_by_aim(idlforcevelocity);
    
velocity[2] = lheight;
    
entity_set_vector(idEV_VEC_velocityvelocity);
    
emit_sound(idCHAN_VOICEg_hunterleapVOL_NORMATTN_NORM0PITCH_NORM);
}

public 
EntityTouch(touchertouched)
{    
    if(!
get_pcvar_num(cvar_semiclip))
        return 
PLUGIN_HANDLED;
    else if (
get_pcvar_num(cvar_semiclip))
         
entity_set_int(toucher,EV_INT_solid,SOLID_NOT);
    
    if(!
get_pcvar_num(cvar_semiclip_ct))
        return 
PLUGIN_HANDLED;    
    else if (
get_pcvar_num(cvar_semiclip_ct) && cs_get_user_team(toucher) == CS_TEAM_CT )
         
entity_set_int(toucher,EV_INT_solid,SOLID_NOT);
    
    if(!
get_pcvar_num(cvar_semiclip_t))
        return 
PLUGIN_HANDLED;    
    else if (
get_pcvar_num(cvar_semiclip_t) && cs_get_user_team(toucher) == CS_TEAM_T )
         
entity_set_int(toucher,EV_INT_solid,SOLID_NOT);
    return 
PLUGIN_HANDLED;
}
    

public 
RoundEnd()
{    
    static 
RoundCounter 0;
    
    
RoundCounter ++;
    
    new 
CvarRound get_pcvar_num(cvar_switch);    
    
    new 
players[32], iNumid;
    
get_players(playersiNum);
    
    if(
RoundCounter >= CvarRound && iNum)
    {    
        
        
set_hudmessage(25500, -1.0, -1.016.012.0);
        
show_hudmessage(0"Switching Teams!");

        
        for(new 
0iNumi++)
        {
            
id players[i];
            
            
g_SpawnOn[id] = false
            
            
switch((cs_get_user_team(id)))
            {            
                case 
CS_TEAM_CT:
                {                    
                    
cs_set_user_team(idCS_TEAM_T);
                    
                }
                case 
CS_TEAM_T:
                {
                    
cs_set_user_team(idCS_TEAM_CT);
                }    
            }        
        }
        
        
RoundCounter 0;
    }
    else if (
iNum)
    {
        
set_hudmessage(25500, -1.0, -1.016.012.0);
        
show_hudmessage(0"Rounds left until switching: %d", (CvarRound RoundCounter));
    }
}    
public 
EmitSound(idchannelsample[], Float:volumeFloat:attnflagpitch)
{
    if(!
is_user_connected(id))
        return 
FMRES_IGNORED;

    if(
g_Zombie[id])
    {
        
//KNIFE
        
if (sample[0] == 'w' && sample[1] == 'e' && sample[8] == 'k' && sample[9] == 'n')
        {
            switch(
sample[17])
            {
                case 
'l':
                    return 
FMRES_SUPERCEDE;

                case 
's''w':
                {
                    
emit_sound(idCHAN_WEAPONg_sound_miss[random(sizeof g_sound_miss)], volumeattnflagpitch);
                    return 
FMRES_SUPERCEDE;
                }

                case 
'b''1''2''3''4':
                {
                    
emit_sound(idCHAN_WEAPONg_sound_hit[random(sizeof g_sound_hit)], volumeattnflagpitch);
                    return 
FMRES_SUPERCEDE;
                }
            }
        }
        
//PAIN
        
else if (sample[1] == 'l' && sample[2] == 'a' && sample[3] == 'y')
        {
            
emit_sound(idCHAN_VOICEg_sound_pain[random(sizeof g_sound_pain)], volumeattnflagpitch);
            return 
FMRES_SUPERCEDE;
        }
        
//DEATH
        
else if (sample[7] == 'd' && (sample[8] == 'i' && sample[9] == 'e' || sample[12] == '6'))
        {
            
emit_sound(idCHAN_VOICEg_sound_die[random(sizeof g_sound_die)], volumeattnflagpitch);
            return 
FMRES_SUPERCEDE;
        }
        else if (
sample[6] == 'n' && sample[7] == 'v' && sample[8] == 'g')
            return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;
}

public 
CurrentWeapon(id)
{    
    if(!
is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T)
        return;
    
    
    if(
read_data(2) != CSW_KNIFE )
    {
        
        
engclient_cmd(id"weapon_knife");
        
UTIL_SetModel(idg_ZombieClaws"");
        
        
message_begin(MSG_ONEmsg_hideweaponid)
        
write_byte(HIDE_FLASH HIDE_HP_HUD HIDE_MONEY)
        
message_end()
    }
}

public 
Event_DeathMessage()
{
    new 
victim read_data(2);
    
    
set_task(get_pcvar_float(cvar_respawn), "FM_Respawn"victim);
}

public 
Message_SendAudio(msg_idmsg_destid)
{
    static 
AudioCode[22];
    
get_msg_arg_string(2AudioCodecharsmax(AudioCode));
    
    if(
equal(AudioCode"%!MRAD_terwin"))
        
set_msg_arg_string(2g_sound_zombiewin);
        
    if(
equal(AudioCode"%!MRAD_ctwin"))
        
set_msg_arg_string(2g_sound_humanwin);
    
    if(
equal(AudioCode"!%MRAD_rounddraw"))
        
set_msg_arg_string(2g_sound_humanwin);
    
    return 
PLUGIN_CONTINUE;
}    

public 
FM_Respawn(id)
{    
    if(
is_user_connected(id) && !is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T && g_SpawnOn[id])
    {
        
set_pev(id,pev_deadflag,DEAD_RESPAWNABLE)
        
dllfunc(DLLFunc_Thinkid);
    }

    return 
PLUGIN_CONTINUE;
}

public 
Task_HUD(task)
{    
    new 
id task TASKID_HUD
    
    
if(!is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
if(cs_get_user_team(id) == CS_TEAM_T)
    {
        static 
health
        health 
get_user_health(id)
    
        
set_hudmessage(255000.020.9700.00.30.00.0)
        
ShowSyncHudMsg(idg_hudsync "Health: %d || Destroy All Survivor|| Visit our website www.gamestreets.eu"health)
    
        
set_task(0.1"Task_HUD"TASKID_HUD id)    
    }
    return 
PLUGIN_CONTINUE
}
/*=========================Stocks=============================*/

stock UTIL_SetModel ( const PlayerId, const viewModel[], weaponModel[] )
{
    
entity_set_stringPlayerIdEV_SZ_viewmodelviewModel);
    
entity_set_stringPlayerIdEV_SZ_weaponmodelweaponModel);


Dragonus

YamiKaitou 03-11-2013 12:07

Re: Plugin Error
 
AMXX file removed, do not upload it again

Podarok 03-11-2013 14:21

Re: Plugin Error
 
Oh, its bad coded!

fysiks 03-12-2013 19:55

Re: Plugin Error
 
You need to debug the code. Find out where it segfaults. I do this by using server_print() in a whole lot of places and see which one is the last one printed.


All times are GMT -4. The time now is 21:43.

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