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

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


Post New Thread Reply   
 
Thread Tools Display Modes
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 08-07-2014 , 16:56   Re: First Blood Reward v1.3 (Bot Support)
Reply With Quote #11

Code:
cs_set_user_money(attacker, cs_get_user_money(attacker) + iReward)

You should check if the player already has (16000 - reward) or more so you set his money to 16000.
__________________
Kia is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 08-07-2014 , 18:23   Re: First Blood Reward v1.3 (Bot Support)
Reply With Quote #12

PHP Code:
cs_set_user_money(idclamp(cs_get_user_money(id) + iReward016000)) 
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 08-07-2014 , 20:52   Re: First Blood Reward v1.3 (Bot Support)
Reply With Quote #13

Quote:
Originally Posted by Kia View Post
You should check if the player already has (16000 - reward) or more so you set his money to 16000.
Quote:
Originally Posted by Flick3rR View Post
PHP Code:
cs_set_user_money(idclamp(cs_get_user_money(id) + iReward016000)) 
Thank you both of you. I will update the code. ;)

Last edited by zmd94; 08-07-2014 at 20:53.
zmd94 is offline
Old 08-08-2014, 04:20
HamletEagle
This message has been deleted by HamletEagle.
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 08-08-2014 , 21:12   Re: First Blood Reward v1.4 (Bot Support)
Reply With Quote #14

New update!
Quote:
v1.4 - [FIXED] The code for giving money and error on line 18.
zmd94 is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 08-09-2014 , 03:26   Re: First Blood Reward v1.4 (Bot Support)
Reply With Quote #15

Code:
if(bFirstBlood || victim == attacker || !is_user_connected(attacker))

I would check first if the user is connected / alive before checking if he is also the victim, sounds more logically to me.

Code:
ShowSyncHudMsg(0, g_SyncHud, "%s drew a firstblood^nand recieved %d money as a reward.", szName, iReward)

You do not need a SyncHud for a HUD Message that gets only shown once. Just use show_hudmessage.

Code:
get_user_name(attacker, szName, 31)

Please get used to use charsmax or sizeof - 1 instead of writing the number.
__________________
Kia is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 08-09-2014 , 03:34   Re: First Blood Reward v1.5 (Bot Support)
Reply With Quote #16

New update!
Quote:
v1.5 - [ADDED] Cvar to enable or disable the health, armor and money rewards.
Quote:
Originally Posted by Kia View Post
Code:
if(bFirstBlood || victim == attacker || !is_user_connected(attacker))


I would check first if the user is connected / alive before checking if he is also the victim, sounds more logically to me.

Code:
ShowSyncHudMsg(0, g_SyncHud, "%s drew a firstblood^nand recieved %d money as a reward.", szName, iReward)


You do not need a SyncHud for a HUD Message that gets only shown once. Just use show_hudmessage.
Thank you. I will update the code. ;)

However, may you tell more about this?
Quote:
Originally Posted by Kia View Post
Code:
get_user_name(attacker, szName, 31)


Please get used to use charsmax or sizeof - 1 instead of writing the number.

Last edited by zmd94; 08-09-2014 at 03:46.
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 08-09-2014 , 07:42   Re: First Blood Reward v1.5 (Bot Support)
Reply With Quote #17

Quote:
Originally Posted by zmd94 View Post
However, may you tell more about this?
Writting number is sort of hardcoded. Using charsmax is the optmized way. Well, it won't really affect the usage of plugin, just something for have a better code.
__________________
Jhob94 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 08-09-2014 , 09:02   Re: First Blood Reward v1.5 (Bot Support)
Reply With Quote #18

Quote:
Originally Posted by Jhob94 View Post
Writting number is sort of hardcoded. Using charsmax is the optmized way. Well, it won't really affect the usage of plugin, just something for have a better code.
Thank you for the explanation. I appreaciate it. ;)

So, is it true that I should change it into this?
Quote:
get_user_name(attacker, szName, charsmax(31))

Last edited by zmd94; 08-09-2014 at 09:05.
zmd94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 08-09-2014 , 09:37   Re: First Blood Reward v1.5 (Bot Support)
Reply With Quote #19

No

get_user_name(attacker, szName, charsmax(szName))
__________________
Jhob94 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 08-09-2014 , 09:43   Re: First Blood Reward v1.5 (Bot Support)
Reply With Quote #20

Quote:
Originally Posted by Jhob94 View Post
No

get_user_name(attacker, szName, charsmax(szName))
Thank you. I will update the code.
zmd94 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 01:03.


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