Raised This Month: $ Target: $400
 0% 

Gravity buy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Compro
Junior Member
Join Date: Nov 2011
Old 11-21-2011 , 13:40   Gravity buy
Reply With Quote #1

Hi , i made code , who will allow to buy a gravity, compiles without errors and warnings, but in server when i type /gv, the gravity dont reduces. Where is a mistake in my code ?

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

#define PLUGIN "TEST"
#define VERSION "1.0"
#define AUTHOR "TEST"


public plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)
register_clcmd("say /gv","cmd_gravity")

}
public 
cmd_gravity(id)
{
if(!
is_user_alive(id))
{
  
client_print(id,print_chat,"Dead players can't buy!")
}
else if(
cs_get_user_money(id)<10000)
{
  
client_print(id,print_chat,"You dont have enough money!")
}
else
{
  
cs_set_user_money(id,cs_get_user_money(id) - 10000)
  
set_user_gravity(id,0.5)
}
return 
PLUGIN_HANDLED


Last edited by Compro; 11-21-2011 at 13:41.
Compro is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-21-2011 , 13:46   Re: Gravity buy
Reply With Quote #2

PHP Code:
public plugin_init ( )
{
     
register_clcmd "say /gv""change_gravity" )
}

public 
change_gravity index )
{
     if ( !
is_user_alive index ) )
     {
          
client_print indexprint_chat"Dead players can't buy gravity." )

          return 
PLUGIN_HANDLED
     
}

     new 
i_PlayerMoney

     i_PlayerMoney 
cs_get_user_money index )

     if ( 
i_PlayerMoney 10000 )
     {
          
client_print indexprint_chat"You need 10.000$ to buy gravity." )

          return 
PLUGIN_HANDLED
     
}

     
set_user_gravity index0.5 )

     
cs_set_user_money indexi_PlayerMoney 10000 )

     return 
PLUGIN_HANDLED

Korxu 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 08:25.


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