Raised This Month: $ Target: $400
 0% 

[AMXX] Run time error 3: stack error.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-07-2009 , 13:42   [AMXX] Run time error 3: stack error.
Reply With Quote #1

What that means?
xbatista is offline
Send a message via Skype™ to xbatista
padilha007
Senior Member
Join Date: Jul 2008
Old 05-07-2009 , 14:10   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #2

put your code
__________________

padilha007 is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-07-2009 , 14:18   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #3

PHP Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <fakemeta> 
#include <cstrike> 
#include <fun> 

#define PLUGIN "Infection" 
#define VERSION "1.0" 
#define AUTHOR "xXx" 

#define MODELSET_TASK 100 
#define MODELCHANGE_DELAY 0.2 // delay between model changes

enum       
{  
    
ATTR_NO 0,  
    
ATTR_DEAD,  
    
ATTR_BOMB,  
    
ATTR_VIP   
};  

new 
bool:g_isZombie[32]; 
new 
bool:g_bFirstZombie

new 
Float:g_models_targettime // target time for the last model change
new Float:g_roundstarttime // last round start time

new g_has_custom_model[33// whether the player is using a custom model
new g_player_model[33][32// player's model name (string)

new const ZOMBIE_MODEL[] = "MD_Zombie"

new 
Float:z_time 12.0

new 
g_Terrorists
new 
g_CounterTerrorists
new 
g_iMaxPlayers

// Do infection and don't set player's attributions
new g_msgDeathMsgg_msgScoreAttrib 

public plugin_precache() 

    new 
modelpath[100
    
formatexmodelpathcharsmaxmodelpath ), "models/player/%s/%s.mdl"ZOMBIE_MODELZOMBIE_MODEL 
    
engfuncEngFunc_PrecacheModelmodelpath 



public 
plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR); 
     
    
register_logevent("Logevent_Round_Start"2"1=Round_Start"
    
register_event("CurWeapon""zm_check_zombie_weapon""be""1=1"); 
     
    
register_logevent("Event_Round_End"2"1=Round_End"); 
    
register_logevent("Event_Round_End"2"1&Restart_Round_"); 
     
    
register_forward(FM_SetClientKeyValue"fw_SetClientKeyValue"); 
    
register_forward(FM_ClientUserInfoChanged"fw_ClientUserInfoChanged"); 
     
    
RegisterHam(Ham_TakeDamage"player""fw_Damage"1); 
    
RegisterHam(Ham_Killed,"player","fw_playerKilled"1); 
//  RegisterHam(Ham_Spawn,"player","fw_playerSpawn",1); 
     
    
set_cvar_string("sv_skyname""space"); 
     
    
g_msgDeathMsg get_user_msgid("DeathMsg"); 
    
g_msgScoreAttrib get_user_msgid("ScoreAttrib"); 
     
    
g_iMaxPlayers get_maxplayers(); 
     


/*================================================================================ 
 [Round Start Logevent]
=================================================================================*/ 
public Logevent_Round_Start() 

    
g_roundstarttime get_gametime()
    
/* Set task to choose first zombie */ 
    
set_task(z_time"zm_first_zombie"0); 
     
    
/* Set task to warn of first zombie */ 
    
set_task(2.0"zm_zombie_warning"0); 
     
    
/* Set first zombie being chosen to false */ 
    
g_bFirstZombie false
     
    
/* Take zombie model off */ 
    
for(new iClient 1iClient <= g_iMaxPlayersiClient++) 
    { 
        
// Remove previous tasks (if any)
        
remove_taskiClient MODELSET_TASK )
        
        if( 
g_has_custom_model[iClient] ) 
        { 
            
fm_reset_user_model(iClient
        } 
    } 


/*================================================================================ 
 [Round End Event]
=================================================================================*/ 
public Event_Round_End() 

    
/* Check and see if the first zombie was chosen (not a warmup round) */ 
    
if(g_bFirstZombie
        return 
PLUGIN_CONTINUE
         
    
/* Set first zombie being picked to false */ 
    
g_bFirstZombie false
     
    
/* Scramble teams and set zombie bool to false*/ 
    
for(new iUser 1iUser <= g_iMaxPlayersiUser++) 
    { 
         
        new 
iTeamScramble;
        
iTeamScramble get_user_team(iUser); 
        if(
iTeamScramble != && iTeamScramble != 4
        { 
             
            new 
iRandTeam random_num(1,2); 
            if(
is_user_alive(iUser)) 
                
cs_set_user_team(iUseriRandTeam); 
             
        } 
        
g_isZombie[iUser] = false
    } 
     
    return 
PLUGIN_CONTINUE


/*================================================================================ 
 [zm_zombie_warning] -> Warn of first zombie 
=================================================================================*/ 
public zm_zombie_warning() 

    
set_hudmessage(25500, -1.00.4000.00.30.00.0); 
    
show_hudmessage(0"The first zombie will be chosen in %d seconds"floatround(z_time 2.0)); 


/*================================================================================ 
 [zm_first_zombie] -> Select first zombie 
=================================================================================*/ 
public zm_first_zombie() 

     
    
/* Check and see if the first zombie was chosen already*/ 
    
if(g_bFirstZombie
        return 
PLUGIN_CONTINUE
     
    
/* Set amount of people on each team */ 
    
g_Terrorists 0
    
g_CounterTerrorists 0
     
    
/* Pick the first zombie */ 
    
new iClient[32], livePlayersiUser
    
get_players(iClientlivePlayers"a"); 
    new 
iZombie random_num(1livePlayers); 
    for(
iUser 1iUser <= livePlayersiUser++) 
    { 
        if(
is_user_alive(iUser)) 
        { 
         
            if(
iUser == iZombie
            { 
             
                
g_isZombie[iUser] = true
                
g_Terrorists g_Terrorists 1
                
zm_set_user_zombie(iUser); 
            } 
            else if(
iUser != iZombie
            { 
                
cs_set_user_team(iUser2); 
                
g_CounterTerrorists g_CounterTerrorists 1
            }  
        } 
     
    } 
    if(
g_Terrorists >= 1
    { 
        
/* Set first zombie being picked to true */ 
        
g_bFirstZombie true
         
        
/* Display zombie chosen notice */ 
        
new iName[33]; 
        
get_user_name(iZombieiName32); 
        
set_hudmessage(25500, -1.00.4000.00.30.00.0); 
        
show_hudmessage(0"%s is the first zombie! OH NO"iName); 
    } 
    else 
    { 
        
/* OOPS the first zombie wasnt chosen! lets try it again */ 
        
set_task(0.1"zm_first_zombie"0"","a" 1); 
    } 
    
    return 
PLUGIN_CONTINUE


/*================================================================================ 
 [zm_set_user_zombie] -> give user zombie powers 
=================================================================================*/ 
public zm_set_user_zombie(id

     
    if(
g_isZombie[id]) 
    { 
        
cs_set_user_team(id1); 
        
strip_user_weapons(id); 
        
give_item(id"weapon_knife"); 
        
set_user_health(id2000); 
        
cs_set_user_nvg(id1); 

        
// Store our custom model in g_player_model[id]
        
copyg_player_model[id], charsmaxg_player_model[] ), ZOMBIE_MODEL )
        
        
// Get current model
        
new currentmodel[32]
        
fm_get_user_modelidcurrentmodelcharsmaxcurrentmodel ) )
        
        
// Check whether it matches the custom model
        
if ( !equalcurrentmodelg_player_model[id] ) )
        {
            
// An additional delay is offset at round start
            // since SVC_BAD is more likely to be triggered there
            
if ( get_gametime() - g_roundstarttime 5.0 )
                
set_task5.0 MODELCHANGE_DELAY"fm_user_model_update"id MODELSET_TASK )
            else
                
fm_user_model_updateid MODELSET_TASK )
        }
    } 


/*================================================================================ 
 [fw_SetClientKeyValue] -> prevent users from changing their model 
=================================================================================*/ 
public fw_SetClientKeyValueid, const infobuffer[], const key[] ) 
{    
    
// Block CS model changes
    
if ( g_has_custom_model[id] && equalkey"model" ) )
        return 
FMRES_SUPERCEDE;
    
    return 
FMRES_IGNORED;


/*================================================================================ 
 [fw_ClientUserInfoChanged] -> prevent users from changing their model 
=================================================================================*/ 
public fw_ClientUserInfoChangedid 

    
// Player doesn't have a custom model
    
if ( !g_has_custom_model[id] )
        return 
FMRES_IGNORED;
    
    
// Get current model
    
static currentmodel[32]
    
fm_get_user_modelidcurrentmodelcharsmaxcurrentmodel ) )
    
    
// Check whether it matches the custom model - if not, set it again
    
if ( !equalcurrentmodelg_player_model[id] ) && !task_existsid MODELSET_TASK ) )
        
fm_set_user_modelid MODELSET_TASK )
    
    return 
FMRES_IGNORED

/*================================================================================
 [Tasks]
=================================================================================*/

public fm_user_model_updatetaskid )
{
    static 
Float:current_time
    current_time 
get_gametime()
    
    
// Do we need a delay?
    
if ( current_time g_models_targettime >= MODELCHANGE_DELAY )
    {
        
fm_set_user_modeltaskid )
        
g_models_targettime current_time
    
}
    else
    {
        
set_task( (g_models_targettime MODELCHANGE_DELAY) - current_time"fm_set_user_model"taskid )
        
g_models_targettime g_models_targettime MODELCHANGE_DELAY
    
}
}

public 
fm_set_user_modelplayer )
{
    
// Get actual player id
    
player -= MODELSET_TASK
    
    
// Set new model
    
engfuncEngFunc_SetClientKeyValueplayerengfuncEngFunc_GetInfoKeyBufferplayer ), "model"g_player_model[player] )
    
    
// Remember this player has a custom model
    
g_has_custom_model[player] = true
}

/*================================================================================ 
 [zm_check_zombie_weapon] -> Make sure zombies only use knives 
=================================================================================*/ 
public zm_check_zombie_weapon(iClient

    if(!
is_user_alive(iClient))
        return;
    
    new 
weapon read_data(2)
    if(
g_isZombie[iClient]) 
    { 
        if(
weapon != CSW_KNIFE
        { 
            
engclient_cmd(iClient"weapon_knife")
            
strip_user_weapons(iClient); 
            
give_item(iClient"weapon_knife"); 
        } 
    } 

/*================================================================================ 
 [fw_PlayerKilled] -> Use this to execute on player spawn 
=================================================================================*/ 
public fw_playerKilled(iClient

    new 
CsTeams:iVictimTeam cs_get_user_team(iClient); 
     
    switch (
iVictimTeam
    { 
        case 
CS_TEAM_CTg_CounterTerrorists -- 
        case 
CS_TEAM_T:  g_Terrorists -- 
    } 


/*================================================================================ 
 [fw_Damage] -> Use this to execute on damage 
=================================================================================*/ 
public fw_Damage(iVictimiInflictoriAttacker


    if(!
g_bFirstZombie
        return 
HAM_IGNORED
         
    if(
iVictim != iAttacker && is_user_alive(iAttacker) && is_user_alive(iVictim)  
    && 
g_isZombie[iAttacker] && get_user_weapon(iAttacker) == CSW_KNIFE  
    
&& g_CounterTerrorists && cs_get_user_team(iVictim) == CS_TEAM_CT
    { 
        
message_begin(MSG_ALLg_msgDeathMsg
        
write_byte(iAttacker
        
write_byte(iVictim
        
write_string("infected"
        
message_end() 
     
        
message_begin(MSG_ALLg_msgScoreAttrib
        
write_byte(iVictim
        
write_byte(ATTR_NO
        
message_end()
     
        
g_isZombie[iVictim] = true
        
zm_set_user_zombie(iVictim); 
    } 
     
    return 
HAM_HANDLED

/*================================================================================
 [Stocks]
=================================================================================*/

stock fm_get_user_modelplayermodel[], len )
{
    
// Retrieve current model
    
engfuncEngFunc_InfoKeyValueengfuncEngFunc_GetInfoKeyBufferplayer ), "model"modellen )
}

stock fm_reset_user_modelplayer )
{
    
// Player doesn't have a custom model any longer
    
g_has_custom_model[player] = false
    
    dllfunc
DLLFunc_ClientUserInfoChangedplayerengfuncEngFunc_GetInfoKeyBufferplayer ) )

xbatista is offline
Send a message via Skype™ to xbatista
padilha007
Senior Member
Join Date: Jul 2008
Old 05-07-2009 , 14:28   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #4

no error in your code
__________________

padilha007 is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-07-2009 , 14:29   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #5

LOG returns this error.
When I disable this, then all works fine, no errors. :0

P.S. I've tryied to set map to "a" lights, hands have a big brightness,when I'm not in shadow :0

Last edited by xbatista; 05-07-2009 at 14:41.
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-08-2009 , 11:59   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #6

Quote:
Originally Posted by padilha007 View Post
no error in your code
Except a big mistake on get_players usage.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-08-2009 , 12:07   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #7

What is wrong I check it
http://www.amxmodx.org/funcwiki.php?go=func&id=174
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-08-2009 , 12:15   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #8

Code:
    /* Pick the first zombie */     new iClient[32], livePlayers, iUser;     get_players(iClient, livePlayers, "a");     new iZombie = random_num(1, livePlayers);     for(iUser = 1; iUser <= livePlayers; iUser++)     {         if(is_user_alive(iUser))

->

if(is_user_alive(iClient[iUser]))

(you should rename iUser -> iNum)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-08-2009 , 12:24   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #9

Seems to work, but there are another problem :/ Look at code, why v_ model is very brightness? :0

Last edited by xbatista; 05-08-2009 at 12:37.
xbatista is offline
Send a message via Skype™ to xbatista
padilha007
Senior Member
Join Date: Jul 2008
Old 05-07-2009 , 14:42   Re: [AMXX] Run time error 3: stack error.
Reply With Quote #10

line?
__________________

padilha007 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 08:22.


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