Raised This Month: $51 Target: $400
 12% 

[Help] Need help with code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 11-17-2014 , 16:29   [Help] Need help with code
Reply With Quote #1

i want
when victim frag 0
killer not take him frags
PHP Code:
set_user_frags(killerget_user_frags(killer) + amount);
set_user_frags(victimget_user_frags(victim) - amount); 
__________________

Last edited by popeye10; 11-17-2014 at 16:33.
popeye10 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-17-2014 , 16:36   Re: [Help] Need help with code
Reply With Quote #2

Quote:
Originally Posted by popeye10 View Post
i want
when victim frag 0
killer not take him frags
PHP Code:
set_user_frags(killerget_user_frags(killer) + amount);
set_user_frags(victimget_user_frags(victim) - amount); 
if(!get_user_frags(victim)) return PLUGIN_HANDLED
__________________
Jhob94 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-17-2014 , 19:22   Re: [Help] Need help with code
Reply With Quote #3

Quote:
Originally Posted by Jhob94 View Post
if(!get_user_frags(victim)) return PLUGIN_HANDLED
And how is that advice helpful?
__________________

Last edited by fysiks; 11-17-2014 at 19:22.
fysiks is online now
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-18-2014 , 00:45   Re: [Help] Need help with code
Reply With Quote #4

Maybe, this can help.
PHP Code:
if(get_user_frags(isVictim))
{
    
set_user_frags(isAttackerget_user_frags(isAttacker) + iAmount)
    
set_user_frags(isVictimget_user_frags(isVictim) - iAmount)


Last edited by zmd94; 11-18-2014 at 04:19.
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-18-2014 , 04:08   Re: [Help] Need help with code
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
And how is that advice helpful?
You don't know read? He asked how to check if user has not frags, so i told him.. How is your reply helpful?
__________________
Jhob94 is offline
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 11-18-2014 , 04:08   Re: [Help] Need help with code
Reply With Quote #6

Quote:
Originally Posted by zmd94 View Post
Maybe, this can help.
PHP Code:
// If only if the victim frag is more than "0"
if(get_user_frags(isVictim) >= 0)
{
    
set_user_frags(isAttackerget_user_frags(isAttacker) + iAmount)
    
set_user_frags(isVictimget_user_frags(isVictim) - iAmount)

thanx zmd94 it' work
__________________
popeye10 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-18-2014 , 04:12   Re: [Help] Need help with code
Reply With Quote #7

Its useless to do checks if is higher than 0, you just need:
PHP Code:
if(get_user_frags(isVictim)) 

    
set_user_frags(isAttackerget_user_frags(isAttacker) + iAmount
    
set_user_frags(isVictimget_user_frags(isVictim) - iAmount

Anyway if you check if frags = 0, then it will also affect when frags are 0.
__________________
Jhob94 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-18-2014 , 04:19   Re: [Help] Need help with code
Reply With Quote #8

My fault, Jhob94.

I have updated the code. ;)

Last edited by zmd94; 11-18-2014 at 04:41.
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-18-2014 , 04:27   Re: [Help] Need help with code
Reply With Quote #9

Quote:
Originally Posted by zmd94 View Post
My fault, Jhob94. I have updated the code.
Man
You forgot the wink
__________________
Jhob94 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-18-2014 , 19:26   Re: [Help] Need help with code
Reply With Quote #10

Quote:
Originally Posted by Jhob94 View Post
You don't know read? He asked how to check if user has not frags, so i told him.. How is your reply helpful?
I didn't find your post helpful because your code was given without any context. It's useless without context because you don't know where in his code he wants the functionality. Returning in a random place doesn't generally do any good unless you know all the code that exists in the function.
__________________
fysiks is online now
Reply



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 00:05.


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