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

[API] CS Reward v6.1 (21 Rewards)


Post New Thread Reply   
 
Thread Tools Display Modes
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-28-2014 , 04:48   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #41

New update!
Quote:
v3.1 - [ADDED] Adding the ID of a task so that we can remove the task when the player that recieve the reward is being killed or disconnect from the server.
v3.1 - [FIXED] Improve the readibility of the code (Credit to wbyokowo for helping).
v3.1 - [ADDED] The information about the HP, amor and money limit in the cs_reward.cfg file.

Last edited by zmd94; 10-28-2014 at 06:17.
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-28-2014 , 05:17   Re: [Dynamic Natives] CS Reward v3.0 (11 Different Rewards)
Reply With Quote #42

Quote:
Originally Posted by zmd94 View Post
By the way, what are the different between two of this:

1.
PHP Code:
 if(!is_user_alive(attacker) || attacker == victim
2.
PHP Code:
 if(attacker == victim || !is_user_alive(attacker)) 
As I can see that you have used the second option.
To be honest, in this case it does not really matters. You must check always first the most important, the way that makes it have more sense. But here it doesnt seems like really matters.
__________________

Last edited by Jhob94; 10-28-2014 at 07:57. Reason: forgot to put "not" in front of does
Jhob94 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-28-2014 , 06:17   Re: [Dynamic Natives] CS Reward v3.0 (11 Different Rewards)
Reply With Quote #43

Quote:
Originally Posted by Jhob94 View Post
To be honest, in this case it does really matters. You must check always first the most important, the way that makes it have more sense. But here it doesnt seems like really matters.
Alright.
zmd94 is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-28-2014 , 09:15   Re: [Dynamic Natives] CS Reward v3.0 (11 Different Rewards)
Reply With Quote #44

Quote:
Originally Posted by zmd94 View Post
I appreciate it.

I will update the code. ;)

By the way, what are the different between two of this:

1.
PHP Code:
 if(!is_user_alive(attacker) || attacker == victim
2.
PHP Code:
 if(attacker == victim || !is_user_alive(attacker)) 
As I can see that you have used the second option.
1. You call native first.
2. Native call on second check.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-28-2014 , 09:24   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #45

I can see that. Yet, which one is better? Or it doesn't matter as Jhob94 said?
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-28-2014 , 10:08   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #46

Quote:
Originally Posted by zmd94 View Post
I can see that. Yet, which one is better? Or it doesn't matter as Jhob94 said?
You need to check whats more important first. But in this case they are the same, doesn't matters. But imagine that you have a global bool that you have to check. First you check that bool and only after check the bool you check the others. But this isn't even important, just to make plugin has sense.
__________________
Jhob94 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-28-2014 , 10:18   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #47

Quote:
Originally Posted by Jhob94 View Post
You need to check whats more important first. But in this case they are the same, doesn't matters. But imagine that you have a global bool that you have to check. First you check that bool and only after check the bool you check the others. But this isn't even important, just to make plugin has sense.
Now, I got it.

The main point is we must check whats more important first. Yet, if they are the same, it is doesn't matters.;)

Last edited by zmd94; 10-28-2014 at 10:23.
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-28-2014 , 10:26   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #48

Quote:
Originally Posted by zmd94 View Post
Now, I got it.

The main point is we must check whats more important first. Yet, if they are the same, it is doesn't matters.;)
You just need to think what makes more sense to the server check first.
__________________
Jhob94 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-28-2014 , 12:57   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #49

I my opinion worring about such a little thing is useless. It won't make difference, but this is more like "keep good practice". You think what make more sense, but if you can't guess, just put it as you like.
__________________
HamletEagle is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-28-2014 , 14:11   Re: [Dynamic Natives] CS Reward v3.1 (11 Different Rewards)
Reply With Quote #50

Ok to be clear.
this:
PHP Code:
if(attacker == victim || !is_user_alive(attacker)) return; 
is the same as:
PHP Code:
if(attacker == victim) return; //stop here no need to call next native
if(!is_user_alive(attacker)) return; 
Got my point? reduce 1 communication.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019

Last edited by yokomo; 10-28-2014 at 14:15.
yokomo is offline
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 07:52.


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