AlliedModders

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

HowToRuski 08-30-2020 13:47

VIP get_user_attacker
 
Hello, i always get this error/warning thing when i play on the server

PHP Code:

L 08/29/2020 19:07:42Invalid player id 0
L 08
/29/2020 19:07:42: [AMXXDisplaying debug trace (plugin "VIP.amxx")
L 08/29/2020 19:07:42: [AMXXRun time error 10native error (native "get_user_attacker")
L 08/29/2020 19:07:42: [AMXX]    [0VIP.sma::Damage (line 53

I modified the code to my like, and this is what happens,
can anynone help me?
PHP Code:

public Damage(id)
{
    new 
weaponhitpointattacker get_user_attacker(id,weapon,hitpoint)
    if(
attacker<=maxplayers && is_user_alive(attacker) && attacker!=id && is_user_connected(attacker)) // - this is the line i get errors on
    
if (get_user_flags(attacker) & ADMIN_LEVEL_H
    {
        new 
money read_data(2) * get_pcvar_num(mpd)
        if(
hitpoint==1money += get_pcvar_num(mhb)
        
cs_set_user_money(attacker,cs_get_user_money(attacker) + money)
    }



OciXCrom 08-30-2020 16:21

Re: VIP get_user_attacker
 
Show how the event is registered.

ZaX 08-30-2020 17:20

Re: VIP get_user_attacker
 
Invalid player id 0
0 = the server(world)

Code:

if(0 < attacker <= maxplayers && ...)
Anyways, I dont think this check is needed. using "is_user_alive" is enough

Natsheh 08-30-2020 17:37

Re: VIP get_user_attacker
 
Indent your code properly.

HowToRuski 08-31-2020 00:54

Re: VIP get_user_attacker
 
1 Attachment(s)
Quote:

Originally Posted by OciXCrom (Post 2716047)
Show how the event is registered.

Im kinda new to amxx so if youre not busy you can take a look in the code because most of the part you said i didnt understand :(

Black Rose 09-02-2020 11:09

Re: VIP get_user_attacker
 
Code:
public Damage(id) {     if ( ! is_user_connected(id) ) return;     new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint)     if(attacker<=maxplayers && is_user_alive(attacker) && attacker!=id && is_user_connected(attacker)) // - this is the line i get errors on     if (get_user_flags(attacker) & ADMIN_LEVEL_H)     {         new money = read_data(2) * get_pcvar_num(mpd)         if(hitpoint==1) money += get_pcvar_num(mhb)         cs_set_user_money(attacker,cs_get_user_money(attacker) + money)     } }


All times are GMT -4. The time now is 13:55.

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