AlliedModders

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

AwesomeMan 08-11-2013 15:38

Error
 
L 08/11/2013 - 20:29:32: [CSTRIKE] Non-player entity -1 out of range
L 08/11/2013 - 20:29:32: [AMXX] Displaying debug trace (plugin test.amxx")
L 08/11/2013 - 20:29:32: [AMXX] Run time error 10: native error (native "cs_set_weapon_ammo")
L 08/11/2013 - 20:29:32: [AMXX] [0] test.sma::knife (line 251)

This is error i get
This is the function:
PHP Code:

public knife(id)
{
    if(
is_user_alive(id)) {
        new 
clipammo;
        new 
usersweapon get_user_weapon idclipammo );
        if ( 
usersweapon == CSW_C4 ) {
            new 
cclipaammo
            get_user_ammo
(idCSW_DEAGLEcclipaammo)
            if(
is_user_alive(id)) {
                
strip_user_weapons(id)
                
give_item(id,"weapon_knife")
                
cs_set_weapon_ammo(give_item(id"weapon_deagle"), cclip)
            }
        }
    }


Activated by this:
PHP Code:

register_event "CurWeapon""knife""b" ); 

And line 251 is this:
PHP Code:

cs_set_weapon_ammo(give_item(id"weapon_deagle"), cclip

It just fills up my error log file. How can I fix it?

Cheezpuff 08-11-2013 16:01

Re: Error
 
PHP Code:

public knife(id

    if(
is_user_alive(id)) { 
        new 
clipammo
        new 
usersweapon get_user_weapon idclipammo ); 
        if ( 
usersweapon == CSW_C4 ) { 
            new 
cclipaammo 
            get_user_ammo
(idCSW_DEAGLEcclipaammo
            if(
is_user_alive(id)) { 
                
strip_user_weapons(id
                
give_item(id,"weapon_knife"
                
cs_set_weapon_ammo(give_item(id"weapon_deagle"), cclip
            } 
        } 
    } 


:arrow:
PHP Code:

public knife(id)
{
    if(
is_user_alive(id)) {
        new 
clipammo;
        new 
usersweapon get_user_weapon idclipammo );
        if ( 
usersweapon == CSW_C4 ) {
            new 
cclipaammo
            get_user_ammo
(idCSW_DEAGLEcclipaammo)
            if(
is_user_alive(id)) {
                
fm_strip_user_weaponsid )
                
fm_give_itemid"weapon_knife" )
                
cs_set_user_ammoid,"weapon_deagle"), cclip)    
            }
        }
    }


i think, and try to remove cclip) from weapon_deagle then complie

AwesomeMan 08-11-2013 18:20

Re: Error
 
Works great so far. Cheers mate!


All times are GMT -4. The time now is 15:47.

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