Raised This Month: $ Target: $400
 0% 

[Help] Log errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Plc0tad0
New Member
Join Date: May 2012
Old 05-07-2012 , 06:50   [Help] Log errors
Reply With Quote #1

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

public plugin_init()
{
    
register_plugin("VIPAdd""1.0""Plc0tad0")
    
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawn"1)
}

public 
HamPlayerSpawn(id)
{
    if(
get_user_flags(id) & ADMIN_RESERVATION)
    {
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
        
give_item(id"weapon_m3")
        
give_item(id"weapon_deagle")
        
give_item(id"weapon_hegrenade")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_smokegrenade")
        
cs_set_user_bpammo(idCSW_DEAGLE35)
        
cs_set_user_bpammo(idCSW_M332)
        
set_user_health(id200)
        
set_user_armor(id200)
    }

I'm new in programming so i am still learning. Works, but i get this log error. Whats happened?
Bad english

Code:
L 05/07/2012 - 10:33:19: Start of error session.
L 05/07/2012 - 10:33:19: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20120507.log")
L 05/07/2012 - 10:33:19: [FUN] Invalid player 1
L 05/07/2012 - 10:33:19: [AMXX] Displaying debug trace (plugin "vipadd.amxx")
L 05/07/2012 - 10:33:19: [AMXX] Run time error 10: native error (native "strip_user_weapons")
L 05/07/2012 - 10:33:19: [AMXX]    [0] vipadd.sma::HamPlayerSpawn (line 17)

Last edited by Plc0tad0; 05-07-2012 at 07:32.
Plc0tad0 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-07-2012 , 07:26   Re: [Help] Log errors
Reply With Quote #2

I know how to fix this, however I'd also like to know exactly why it happens? I can only assume it's some other kind of entity being spawned which is weird because the hook is for players only and post hook too. Explanation anyone?

This'll remove that error:

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

public plugin_init()
{
    
register_plugin("VIPAdd""1.0""Plc0tad0")
    
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawn"1)
}

public 
HamPlayerSpawn(id)
{
    if( !
is_user_aliveid ) )
        return 
HAM_IGNORED;
    
    if(
get_user_flags(id) & ADMIN_RESERVATION)
    {
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
        
give_item(id"weapon_m3")
        
give_item(id"weapon_deagle")
        
give_item(id"weapon_hegrenade")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_smokegrenade")
        
cs_set_user_bpammo(idCSW_DEAGLE35)
        
cs_set_user_bpammo(idCSW_M332)
        
set_user_health(id200)
        
set_user_armor(id200)
    }
    
    return 
HAM_IGNORED;

__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-07-2012 at 07:32. Reason: Just fixed it ... it wasn't going to work that way
hornet is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 05-07-2012 , 07:38   Re: [Help] Log errors
Reply With Quote #3

Quote:
Originally Posted by hornet View Post
I know how to fix this, however I'd also like to know exactly why it happens?
I think it happen because he forgot check
Code:
if ( is_user_alive( id ) )
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-07-2012 , 07:42   Re: [Help] Log errors
Reply With Quote #4

Well yes ultimately that fixes the issue, but being a post hook, wouldn't you assume that the player has already spawned so therefor is alive?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Plc0tad0
New Member
Join Date: May 2012
Old 05-07-2012 , 08:02   Re: [Help] Log errors
Reply With Quote #5

hmmm.. so i need check if user is alive, ok. Thanks a lot.

Quote:
Originally Posted by hornet View Post
Well yes ultimately that fixes the issue, but being a post hook, wouldn't you assume that the player has already spawned so therefor is alive?
I agree with you
Plc0tad0 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-08-2012 , 19:21   Re: [Help] Log errors
Reply With Quote #6

Still wondering if anyone has an explanation as to why this happens ( out of curiosity ) ?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 00:28.


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