Raised This Month: $ Target: $400
 0% 

Please help me with my first stupid plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-23-2009 , 18:57   Re: Please help me with my first stupid plugin
Reply With Quote #1

I commented the code for you.

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "Nisteia_Sta_Goodys"
#define VERSION "1.0"
#define AUTHOR "Sp3rMiNaToR"

/* Controllable Variables (cvars) */
new plugin_on
new price_food
new price_drink

/* Initialize the plugin */
public plugin_init()
{
    
/* Register the plugin - This is needed for the plugin to run and compile */
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /food""Hamburger_Kai_Patates");
    
register_clcmd("say /drink""Coca_Cola");
    
    
/* Giving your cvars their variable */
    
plugin_on register_cvar("amx_goodys""1");
    
price_food register_cvar("amx_price_food""1400");
    
price_drink register_cvar("amx_price_drink""900");
}
public 
Hamburger_Kai_Patates(id)
{
    
/* If the plugin isn't enabled (amx_goodys is set to 0) */
    /* The '!' symbol means NOT or FALSE */
    
if ( !get_pcvar_num(plugin_on) )
    {    
        
client_print(idprint_chat"Simera ta Goodys einai kleista,atyxises!Pane gia gyro");
        return 
PLUGIN_CONTINUE;
    }
    
    new 
money cs_get_user_money(id);
    new 
cost get_pcvar_num(price_food);
    
    
/* If the players money is less than the cost of a burger*/
    
if ( money cost )
    {
        
client_print(idprint_chat"Sygnwmi,alla xreiazesai %d$ parapanw gia na kaneis tin apati sou xD"cost-money);
        return 
PLUGIN_CONTINUE;
    }
    
    
cs_set_user_money(idmoney cost1);  
    
set_user_health(idget_user_health(id) + 50 );
    
set_user_gravityid0.60 );
    
client_print(idprint_chat"Molis agorases 2 hamburger kai mia sos moustarda,prodoti!:P");     
    
    return 
PLUGIN_CONTINUE;
}
public 
Coca_Cola(id)
{
    
/* If the plugin isn't enabled (amx_goodys is set to 0) */
    /* The '!' symbol means NOT or FALSE */
    
if ( !get_pcvar_num(plugin_on) )
    {    
        
client_print(idprint_chat"Simera ta Goodys einai kleista,atyxises!Pane allou gia coca");
        return 
PLUGIN_CONTINUE;
    }
    
    new 
money cs_get_user_money(id);
    new 
cost get_pcvar_num(price_drink);
    
    
/* If the players money is less than the cost of a drink*/
    
if ( money cost )
    {
        
client_print(idprint_chat"Sygnwmi,alla xreiazesai %d$ parapanw gia na pareis coca!Pane gia nero!xD"cost-money);
        return 
PLUGIN_CONTINUE;
    }
    
    
/* 'Else' statement isn't always needed after an 'If' statement */
    
    
cs_set_user_money(idmoney cost);  
    
set_user_health(idget_user_health(id) + 30 );
    
set_user_gravity(id0.70 );
    
client_print(idprint_chat"Molis agorases mia coca cola max!Eisai sta alitheia esy?:P");    
    
    return 
PLUGIN_CONTINUE;

BOYSplayCS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-23-2009 , 22:51   Re: Please help me with my first stupid plugin
Reply With Quote #2

Quote:
/* 'Else' statement isn't always needed after an 'If' statement */
else isn't needed if you return in the preceeding if() statement.
__________________
fysiks is offline
Sp3rMiNaToR
BANNED
Join Date: Apr 2009
Location: Greece ^_^
Old 08-24-2009 , 03:44   Re: Please help me with my first stupid plugin
Reply With Quote #3

Many thanks to tuty,fysiks and BOYPLAYCS!You helped me lot guys!
Sp3rMiNaToR is offline
Send a message via MSN to Sp3rMiNaToR
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 08-24-2009 , 04:34   Re: Please help me with my first stupid plugin
Reply With Quote #4

Quote:
Originally Posted by Sp3rMiNaToR View Post
Many thanks to tuty,fysiks and BOYPLAYCS!You helped me lot guys!
welcome
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-24-2009 , 09:35   Re: Please help me with my first stupid plugin
Reply With Quote #5

Quote:
Originally Posted by Sp3rMiNaToR View Post
Many thanks to tuty,fysiks and BOYPLAYCS!You helped me lot guys!
Your welcome, if you need any further help feel free to PM me or respond here.

@fysiks: Ah, yes, forgot about that - thank you.
BOYSplayCS is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-24-2009 , 18:28   Re: Please help me with my first stupid plugin
Reply With Quote #6

No problem.
__________________
fysiks 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 15:04.


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