Raised This Month: $ Target: $400
 0% 

help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 03-08-2017 , 16:30   help
Reply With Quote #1

could somebody make me quickly simple plugin that gives +2000$ each round to player with M flag..
InteX01 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-08-2017 , 16:35   Re: help
Reply With Quote #2

Code:
#include <amxmodx> #include <cstrike> #include <hamsandwich> #define ADMIN_FLAG ADMIN_LEVEL_A public plugin_init() {     register_plugin("Money On Spawn", "1.0", "DoNii");     RegisterHam(Ham_Spawn, "player", "fw_HamSpawnPost", 1); } public fw_HamSpawnPost(id) {     if(!(is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG))     return HAM_IGNORED;     cs_add_user_money(id, 2000);         return PLUGIN_CONTINUE; } cs_add_user_money(id, const amount) {     if(!is_user_connected(id))     return 0;     cs_set_user_money(id, cs_get_user_money(id) + amount);     return amount; }
__________________

Last edited by edon1337; 03-09-2017 at 15:12.
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-09-2017 , 07:41   Re: help
Reply With Quote #3

First of all

1. Your stock should not have a 'stock' prefix.
2. Why are you returning the ammount?

You don't need a stock. Just:

PHP Code:

public fw_HamSpawnPost(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
        
cs_set_user_money(idcs_get_user_money(id) + 2000)

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-09-2017 at 07:42.
EFFx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-09-2017 , 07:44   Re: help
Reply With Quote #4

Quote:
Originally Posted by EFFx View Post
First of all

1. Your stock should not have a 'stock' prefix.
2. Why are you returning the ammount?

You don't need a stock. Just:

PHP Code:

public fw_HamSpawnPost(id)
{
    if(
is_user_alive(id) && get_user_flags(id) & ADMIN_FLAG)
        
cs_set_user_money(idcs_get_user_money(id) + 2000)

1. It's a stock not a private function Sherlock.
2. It's just my choice.

My code is just fine. Also he never mentioned that user needs to be alive.
__________________

Last edited by edon1337; 03-09-2017 at 07:46.
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-09-2017 , 07:54   Re: help
Reply With Quote #5

I'm not a Sherlock, just tolding you whats correct.

1. Yes, its private, because It should be without.
2. Should have is_user_alive().

Wrong choice.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-09-2017 at 08:12.
EFFx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-09-2017 , 08:11   Re: help
Reply With Quote #6

Quote:
Originally Posted by EFFx View Post
I'm not a Sherlock, just tolding you whats correct.

1. Yes, its private, because It should be without.

Wrong choice.
I wonder why fakemeta_util is full of stocks rather than private functions, or ham_[strip/give]_weapon .
__________________

Last edited by edon1337; 03-09-2017 at 08:14.
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-09-2017 , 08:20   Re: help
Reply With Quote #7

HamletEagle told me that. So I'm just saying what he said.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-09-2017 at 08:20.
EFFx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-09-2017 , 08:21   Re: help
Reply With Quote #8

Quote:
Originally Posted by EFFx View Post
HamletEagle told me that. So I'm just saying what he said.
I'll wait and see what he will say
__________________
edon1337 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-09-2017 , 08:47   Re: help
Reply With Quote #9

Because fakemeta_util is a .inc file, you don't put all the things from it inside your code manually. The stock tag is used only in .inc file, because all the functions in it probably won't be used in the code. In your case, you are using the function, so you don't need the stock tag.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-09-2017 , 10:19   Re: help
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
The stock tag is used only in .inc file, because all the functions in it probably won't be used in the code. In your case, you are using the function, so you don't need the stock tag.
https://forums.alliedmods.net/showthread.php?t=56377

Does that look like an include file to you?
__________________
edon1337 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 17:48.


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