AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   issue blocking buyzone (https://forums.alliedmods.net/showthread.php?t=162443)

Doc-Holiday 07-19-2011 05:21

issue blocking buyzone
 
So... It blocks it but for some reason it gives me a crap load of errors

PHP Code:

//define
#define fm_cs_set_user_nobuy(%1)    set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0) )

//Plugin init
register_message(get_user_msgid("StatusIcon"), "Message_StatusIcon");

public 
Message_StatusIcon(iMsgIdiMsgDestid)  
{
    if(
g_KnivesOnly)
    {
        static 
szIcon[8];  
        
get_msg_arg_string(2szIconcharsmax(szIcon));  
        if( 
equal(szIcon"buyzone") ) 
        {  
            if( 
get_msg_arg_int(1) )  
            {
                
fm_cs_set_user_nobuy(id);
                return 
PLUGIN_HANDLED;  
            }  
        }
    }
      
    return 
PLUGIN_CONTINUE;  


Code:

L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 11 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 14 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 15 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 16 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 17 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 18 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 19 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)
L 07/19/2011 - 02:15:04: [HAMSANDWICH] Invalid player 20 (not in-game)
L 07/19/2011 - 02:15:04: [AMXX] Displaying debug trace (plugin "VoteKnivesOnly.amxx")
L 07/19/2011 - 02:15:04: [AMXX] Run time error 10: native error (native "get_pdata_cbase")
L 07/19/2011 - 02:15:04: [AMXX]    [0] VoteKnivesOnly.sma::StripUserWeapons (line 268)

I tried using is_user_connected(id) and it still gives the errors... it hates me lol i know.. Any ideas why it gives these issues?

Thanks in advanced for the help.

fysiks 07-19-2011 05:26

Re: issue blocking buyzone
 
The error is from the hamsandwich module but I don't see any hamsandwich code there.

Tirant 07-19-2011 06:10

Re: issue blocking buyzone
 
It's better to just make a map info entity and set buying to no team. Do this in plugin_precache()

Code:

#include <engine>

new ent = create_entity("info_map_parameters");
DispatchKeyValue(ent, "buying", "3");
DispatchKeyValue(ent, "bombradius", "1");
DispatchSpawn(ent);


Doc-Holiday 07-19-2011 18:45

Re: issue blocking buyzone
 
Quote:

Originally Posted by fysiks (Post 1513647)
The error is from the hamsandwich module but I don't see any hamsandwich code there.

Yeah thats what i said lol...

It works just fine in battlefield mod/vip mod/ and like 4 other plugins i have it in.

Quote:

Originally Posted by Tirant (Post 1513673)
It's better to just make a map info entity and set buying to no team. Do this in plugin_precache()

Code:

#include <engine>

new ent = create_entity("info_map_parameters");
DispatchKeyValue(ent, "buying", "3");
DispatchKeyValue(ent, "bombradius", "1");
DispatchSpawn(ent);


Plugin precahce is only fired at plugin start correct?? which means it would always block? i need to only block if bool is true.

nikhilgupta345 07-19-2011 18:54

Re: issue blocking buyzone
 
Show the full code. It would also help if you told us which line was line 268.

Also, I don't think the errors you posted are from that part of the code.

Doc-Holiday 07-19-2011 19:08

Re: issue blocking buyzone
 
Quote:

Originally Posted by nikhilgupta345 (Post 1514188)
Show the full code. It would also help if you told us which line was line 268.

Also, I don't think the errors you posted are from that part of the code.

Error code line was wrong... and has been found... 50 of my code uses get_pdata_cbase...

PHP Code:

#define OFFSET_PRIMARYWEAPON    116
#define OFFSET_C4_SLOT        372

public StripUserWeapons(id)
{
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED;
        
    new 
iC4Ent get_pdata_cbase(idOFFSET_C4_SLOT);
    
    if( 
iC4Ent )
    {
        
set_pdata_cbase(idOFFSET_C4_SLOTFM_NULLENT);
    }

    
strip_user_weapons(id);
    
give_item(id"weapon_knife");
    
set_pdata_int(idOFFSET_PRIMARYWEAPON0);

    if( 
iC4Ent )
    {
        
entity_set_int(idEV_INT_weaponsentity_get_int(idEV_INT_weapons) | (1<<CSW_C4));
        
set_pdata_cbase(idOFFSET_C4_SLOTiC4Ent);
        
cs_set_user_bpammo(idCSW_C41);
        
cs_set_user_plant(id1);
    }
    
    if (
g_bomb_targ)
    {
        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_defuse(id1);
        }
    }
    return 
PLUGIN_HANDLED;


Adding in is alive worked just fine. :)

Tirant 07-19-2011 21:10

Re: issue blocking buyzone
 
Check "if (pev_valid(id) == 2)" That will tell you if you can use pdata functions.


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

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