Raised This Month: $32 Target: $400
 8% 

VIP get_user_attacker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 08-30-2020 , 13:47   VIP get_user_attacker
Reply With Quote #1

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)
    }

HowToRuski is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-30-2020 , 16:21   Re: VIP get_user_attacker
Reply With Quote #2

Show how the event is registered.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
ZaX
Senior Member
Join Date: Jan 2015
Old 08-30-2020 , 17:20   Re: VIP get_user_attacker
Reply With Quote #3

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

Last edited by ZaX; 08-30-2020 at 17:22.
ZaX is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-30-2020 , 17:37   Re: VIP get_user_attacker
Reply With Quote #4

Indent your code properly.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-14-2021 at 14:26.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 08-31-2020 , 00:54   Re: VIP get_user_attacker
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
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
Attached Files
File Type: sma Get Plugin or Get Source (VIP.sma - 110 views - 6.6 KB)
HowToRuski is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-02-2020 , 11:09   Re: VIP get_user_attacker
Reply With Quote #6

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)     } }
__________________
Black Rose is offline
Reply


Thread Tools
Display Modes

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 02:32.


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