AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Native error... (https://forums.alliedmods.net/showthread.php?t=127120)

5c0r-|3i0 05-17-2010 05:10

[SOLVED] Native error...
 
PHP Code:

public message_textmsg()
{
    static 
textmsg[27]
    
get_msg_arg_string(2,textmsg26)
// Block drop weapon related messages
if(equal(textmsg[1],"#Weapon_Cannot_Be_Dropped"))
    {
    return 
PLUGIN_HANDLED;
    }
        return 
PLUGIN_CONTINUE;


As you can see , i'm trying to block that "Weapon acnnot be dropped" messages...:(
And here is the errorlog:
Quote:

L 05/17/2010 - 16:04:49: [AMXX] Run time error 10: native error (native "get_msg_arg_string")
L 05/17/2010 - 16:04:49: Invalid message argument

master4life 05-17-2010 05:53

Re: Native error...
 
why do you use Message ? use event

PHP Code:

register_event"TextMsg""EventTextMsg""a""2&#Weapon_Cannot_Be_Dropped" ); 

and then block you function with PLUGIN_HANDLED;

5c0r-|3i0 05-17-2010 07:46

Re: Native error...
 
Thanks....Fixed :(

Exolent[jNr] 05-17-2010 10:02

Re: [SOLVED] Native error...
 
IIRC, you can't block events.

@OP
Your problem was that TextMsg can have a various number of arguments.
You should check get_msg_args() before getting the arg.


All times are GMT -4. The time now is 03:35.

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