AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   [API] CS Reward v6.1 (21 Rewards) (https://forums.alliedmods.net/showthread.php?t=245805)

zmd94 08-07-2014 07:33

[API] CS Reward v6.1 (21 Rewards)
 
4 Attachment(s)
[API]
CS Core + Reward v6.1

(21 Rewards + 4 Forwards)


Status:
UP-TO-DATE
(4/1/2015)



Contents:
Description
What new!
4 new forwards
How to use the "CS Core API"?
How to use the "Reward API"?
Reward API tutorial
List of CS Core API
List of Reward API
Example
Problems. ;)
Error 010: Invalid Function or Declaration?
How to disable the chat message?
Installation
Other features
Credits
To do list
Changelogs
Screenshots
Downloads
Other tutorials. ;)
1. How to configure cooldown for permanent reward? (New!)
2. RGB to color name mapping. Just visit this website to configure the values for the color. ;)
(New!)
Plugins using this API. ;)
1. Premium Member ;)
2. First Blood Bonus (ZP Compatible).
3. Free Weapon.
4.
Terrorist Ability.
5. Free Glow (ZP Compatible).
6. Last 2 Players.
7. Rewards Shop. ;)
8. CS Score.
9. Credit Time (Now, you will recieve credit for playing X amount of time in the server) (Just send me a personal message)
Donation. ;)

Description:Top

This plugin will allow you to give reward or bonus easily. Just use the CS Core API. As example, just download c_24.sma file to see how I'm using the CS Core API. ;)

What new!Top
Quote:

1. Invisibility reward.
2. Noclip reward.
3. Grenades reward.
4. Weapon reward.
5. Health reward.
6. Deadly shot reward.
7. God mode reward.
8. Glow reward.
9. Aura reward.
10. Armor reward.
11. Money reward.
12. Multi-jump reward.
13. Speed boost reward.
14. Unlimited clip reward.
15. Unlimited BP ammo reward.
16. No-recoil reward.
17. Line drawing reward. (This simulates a sort of ability by drawing a line between you and the enemy.) Screenshots. ;)
18. Ring indicator reward. (This ability start at enemy feet and expanded outwards into a much larger sort of ring.) Screenshots. ;)
19. Gravity reward. (New!)
20. Trail reward. (New!) Screenshots. ;)
21. Wall ability reward. (New!) (This ability allow player to penetrate the wall. It is not the same with no-clip.) Screenshots. ;)
Quote:

Deadly Shot is a firepower enhancement item. The user's firepower will be boosted to deal headshot damages and also score headshot kills.
4 New Forwards:Top
PHP Code:

/**
 * This is called during a player spawn
 * param id - ID of client
 */
forward cs_fw_spawn_post(id);

/**
 * This is called when a player becomes the last terrorists
 * param id - ID of client
 */
forward cs_fw_last_terrorist(id)

/**
 * This is called when a player becomes the last counter-terrorists
 * param id - ID of client
 */
forward cs_fw_last_counter(id)

/**
 * This is called when a player has drew the first blood
 * param victim - ID of client
 * param attacker - ID of client
 */
forward cs_fw_first_blood(victimattacker); 

If you want to see how to use this forward, just download the c_24.sma file.

How to use the "CS Core API"?Top

Just download the c_24.sma file to see how I'm using the CS Core API. ;)

Just say /core in your chat. Yet, this command only available for player that has specific flag. If you want to configure the flag, just open the c_24.sma file, then edit below part:
PHP Code:

// Configure which flag will have access to the reward menu
#define ADMIN_FLAG ADMIN_IMMUNITY 

Then, a menu will be opened such below screenshots:

http://img.ctrlv.in/img/14/11/08/545d8b6aad4f4.jpg

http://img.ctrlv.in/img/14/11/08/545d8b7b892d4.jpg

How to use the "Reward API"?Top

Just download the c_24.sma file. You also can try the reward by yourself.

Just say /rm in your chat. Yet, this command only available for player that has specific flag. If you want to configure the flag, just open the c_24.sma file, then edit below part:
PHP Code:

// Configure which flag will have access to the reward menu
#define ADMIN_FLAG ADMIN_IMMUNITY 

Then, a menu will be opened such below screenshots:

http://img.ctrlv.in/img/14/11/05/5459e399446dd.jpg

http://img.ctrlv.in/img/14/11/05/5459e3c0f26fd.jpg

"Reward API" tutorial:Top
-->
List of CS Core API:Top
-->
List of Reward API:Top
-->
Example. ;)Top
-->
Error 010: Invalid Function or Declaration?
Top
http://img.ctrlv.in/img/14/10/29/54517ecfaaeea.png

If you encountered this problem, it mean that you have edited the file and encoded it in the incorrect format. So the solution is:
-->
How to disable the chat message?Top

Now, there is an option to disable or enable custom chat message from the cs_reward.sma file. Just open the cs_reward.sma file, the edit this part:
PHP Code:

//Just uncomment 'CUSTOM_MESSAGE' if your want to enable custom message from cs_reward.sma
#define CUSTOM_MESSAGE 

Installation:Top
1. Just put the cs_core.inc in the include folder. This is crucial.

2. Next, compile the cs_core.sma file. Then, put the .amxx file in the plugin folder. If you just want to use the Reward API, no need to download this.

3. Then, compile the cs_reward.sma file. Then, put the .amxx file in the plugin folder. If you just want to use the CS Core API, no need to download this.

3. Lastly, just compile the c_24.sma file (if you want to test the reward) and put the .amxx file in the plugin folder to see how the CS Core API is working. This is just for example. If you just want to use the CS Core or Reward API in your code, no need to download this.

4. Or you can just use your creativity on how to give the reward to the players or using the forward. Have fun!
Other features:Top

All of the rewards has been designed to do below things:
1. Reset all rewards automatically when the player that recieved it is disconnet.

2. Reset all rewards automatically when the player that recieved it has been killed.

3. Reset all rewards automatically at new round.

4. Reset all rewards automatically at every respawn.

5. Prevent the reward from being given to dead player.

6. Prevent the reward from being given if the native is not being used correctly.
Credits:Top
Quote:

1. WBYOKOMO for his parachute API.
2. Kia for code helping.
3. Jhob94 for code helping and idea.
4. Dar2_Siders for his ideas.
5. v3x for line drawing method.
6. HamletEagle for code helping. ;)
7. Blizzard_87 for spending his time to teach me about API as I'm still newbie. ;)
8. ZP Dave Team for forward method.
9. Xalus for wall ability code. ;)
10. etc
To do list:Top
Quote:

If anyone have any suggestions, feel free to share it.
Changelogs:Top
-->
Screenshots:Top

Downloads:Top
-->
Plugins using this API:Top
1. Premium Member ;)
2. First Blood Bonus (ZP Compatible).
3. Free Weapon.
4.
Terrorist Ability.
5. Free Glow (ZP Compatible).
6. Last 2 Players.
7. Rewards Shop. ;)
8. CS Score.
9. Credit Time (Now, you will recieve credit for playing X amount of time in the server) (Just send me a personal message)

Donation. ;)Top

http://angelbobby.org/wp-content/upl...oDonateNow.jpg
Donate in EUR. ;)

Codes now is at GitHub:

Just visit this site. \o/

Br0k3nPh1LL1p 08-07-2014 14:20

Re: First Blood Reward v1.0 (Bot Support)
 
I commented this (because i get error (i use 1.8.2) ) :

PHP Code:

    //#if defined AMXX_VERSION_NUM < 183
    //RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 0, true)
    //#else
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
//#endif 

And it compiled perfectly. Tested on my listen server ZPA and every time a person infects (not by gun) they dont get rewards (perfect!)
And ofc by gun they get HP, AP and Money! :D
Good Work! :)

EDIT: Also tested with bots, same result! :)

Jhob94 08-07-2014 14:33

Re: First Blood Reward v1.0 (Bot Support)
 
Quote:

Originally Posted by Br0k3nPh1LL1p (Post 2180479)
I commented this (because i get error (i use 1.8.2) ) :

PHP Code:

    //#if defined AMXX_VERSION_NUM < 183
    //RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 0, true)
    //#else
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
//#endif 

And it compiled perfectly. Tested on my listen server ZPA and every time a person infects (not by gun) they dont get rewards (perfect!)
And ofc by gun they get HP, AP and Money! :D
Good Work! :)

EDIT: Also tested with bots, same result! :)

When you infect someone in zp, he doesnt dies. And since he isnt using zp include for detect infections, ofc it will detect first human kill.

Anyway i would suggest you to add zp support to next version. And if running for zp, use cvars if only want ct kills or infections too. Instead of give money, give ap.

Br0k3nPh1LL1p 08-07-2014 14:40

Re: First Blood Reward v1.0 (Bot Support)
 
Quote:

Originally Posted by Jhob94 (Post 2180486)
When you infect someone in zp, he doesnt dies.

I totally forgot about that lol :oops:

Quote:

Originally Posted by Jhob94 (Post 2180486)
And since he isnt using zp include for detect infections, ofc it will detect first human kill.

I should have noticed that..

Quote:

Originally Posted by Jhob94 (Post 2180486)
Anyway i would suggest you to add zp support to next version. And if running for zp, use cvars if only want ct kills or infections too. Instead of give money, give ap.

I was just checking this, and this might be perfect!

Thanks for the reply!

zmd94 08-07-2014 14:54

Re: First Blood Reward v1.0 (Bot Support)
 
@ Br0k3nPh1LL1p, this plugin can be used for ZP. However, it only detected the killed made by human not the zombie.
Quote:

Originally Posted by Jhob94 (Post 2180486)
Anyway I would suggest you to add ZP support to next version. And if running for ZP, use cvars if only want CT kills or infections too. Instead of give money, give ammo packs.

Thank you for the suggestion.

Flick3rR 08-07-2014 15:54

Re: First Blood Reward v1.0 (Bot Support)
 
Well, the money are stated as "bonus", but you actually don't add it to the money that player already has. I'm talking about:
PHP Code:

cs_set_user_money(attackeriReward

Also, you can store the first three checks in Ham_Killed handler as one:
PHP Code:

if(bFirstBlood || victim == attacker || !is_user_connected(attacker)) 
        return; 

The plugin seems to be pretty useful and pottentially good coded. Keep it on!

zmd94 08-07-2014 16:25

Re: First Blood Reward v1.0 (Bot Support)
 
Quote:

Originally Posted by Flick3rR (Post 2180542)
but you actually don't add it to the money that player already has.
PHP Code:

cs_set_user_money(attackeriReward


Sorry, can you explain a little bit?
Quote:

Originally Posted by Flick3rR (Post 2180542)
Also, you can store the first three checks in Ham_Killed handler as one:
PHP Code:

if(bFirstBlood || victim == attacker || !is_user_connected(attacker)) 
        return; 


Thank you for optimizing this code.
Quote:

Originally Posted by Flick3rR (Post 2180542)
The plugin seems to be pretty useful and pottentially good coded. Keep it on!

Thank you very much. :wink:

Flick3rR 08-07-2014 16:27

Re: First Blood Reward v1.0 (Bot Support)
 
I meant that you directly set that ammount of money to the user and don't add it to his current money. And if I have 15000 and make first blood, my money won't get 15500, but 500. And I loose 14500 :D
It should be:
PHP Code:

cs_set_user_money(attackerget_user_money(attacker) + iReward


zmd94 08-07-2014 16:34

Re: First Blood Reward v1.0 (Bot Support)
 
Quote:

Originally Posted by Flick3rR (Post 2180559)
And if I have 15000 and make first blood, my money won't get 15500, but 500. And I loose 14500.

LOL, my silly mistakes. :wink:

Thank you for correcting me.

Quote:

Originally Posted by Flick3rR (Post 2180559)
It should be:
PHP Code:

cs_set_user_money(attackerget_user_money(attacker) + iReward


Now, I understand. Thank you for helping.

Edit: Flick3rR, I think the should be like this, right?
PHP Code:

cs_set_user_money(attackercs_get_user_money(attacker) + iReward


zmd94 08-07-2014 16:50

Re: First Blood Reward v1.3 (Bot Support)
 
New update!
Quote:

v1.2 - [FIXED] Optimizing the code.
v1.3 - [FIXED] The code for giving money.
Feel free to test it. If there are any problems, just inform me. Then, I will do my best to fix it.


All times are GMT -4. The time now is 20:14.

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