Raised This Month: $ Target: $400
 0% 

Float on pcvar problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ianglowz
Senior Member
Join Date: Nov 2008
Old 01-23-2009 , 18:58   Float on pcvar problem.
Reply With Quote #1

I had problem on speed and gravity.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN    "Stat & Weapon Menu"
#define VERSION    "1.1"
#define AUTHOR    "ianglowz"
#define Prefix    "[SnW]"
new plugin_on;
new 
speedpricearmorpricehealthpricegravityprice;
new 
mp5priceawppricescoutprice;
new 
speedarmorhealthgravity
public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR);
 
register_clcmd("say /stat" "statmenu");
 
register_clcmd("say /weapon" "weaponmenu");
 
 
plugin_on    register_cvar("sm_plugin_on","1");
 
speedprice    register_cvar("sm_speed_price","2000");
 
armorprice    register_cvar("sm_armor_price","2000");
 
healthprice    register_cvar("sm_health_price","2500");
 
gravityprice     register_cvar("sm_gravity_price","2000");
 
mp5price    register_cvar("sm_mp5_price","3000");
 
awpprice    register_cvar("sm_awp_price","7000");
 
scoutprice    register_cvar("sm_scout_price","4000");
 
speed    register_cvar("sm_speed","1000.0")  //float
 
armor    register_cvar("sm_armor","200")
 
health    register_cvar("sm_health","200")
 
gravity    register_cvar("sm_gravity","0.4"//float
}
public 
statmenuid ) {
 if( 
get_pcvar_num(plugin_on) == ) {
  
  new 
menu menu_create"Choose your stat""menu_handler");
  
  
menu_additem(menu"Speed""1"0);
  
menu_additem(menu"Armor""2"0);
  
menu_additem(menu"Health""3",0);
  
menu_additem(menu"Gravity""4",0);
  
  
menu_setprop(menuMPROP_EXITMEXIT_ALL);
  
menu_display(idmenu0);
 }
}
public 
menu_handler(idmenuitem) {
 if (
item == MENU_EXIT) {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], iName[64]
 new 
accesscallback
 
 menu_item_getinfo
(menuitemaccessdata,5iName63callback)
 
 new 
key str_to_num(data)
 switch( 
key ) {
  case 
1: {    
   new 
money cs_get_user_money(id);
   
   if (
money >= get_pcvar_num(speedprice)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(speedprice));    
    
client_print(idprint_chat"%s You have selected Speed Stats."Prefix
    
set_user_maxspeed(idget_pcvar_num(speed))    
    } else {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
  
  case 
2:{
   new 
money cs_get_user_money(id);
   
   if (
money >= get_pcvar_num(armorprice)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(armorprice));
    
client_print(idprint_chat"%s You have selected Armor Stats."Prefix)
    
set_user_armor(id,get_pcvar_num(armor))
    } else {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
  
  case 
3:{ 
   new 
money cs_get_user_money(id);
   
   if (
money >= get_pcvar_num(healthprice)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(healthprice));    
    
client_print(idprint_chat"%s You have choose Health Stats"Prefix)
    
set_user_health(id,get_pcvar_num(health))
    }  else  {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
 
  case 
4:{
   new 
money cs_get_user_money(id);    
   
   if (
money >= get_pcvar_num(healthprice)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(gravityprice));    
    
client_print(idprint_chat"%s You have choose Gravity Stats"Prefix)
    
set_user_gravity(id,get_pcvar_num(gravity))
    }  else  {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
 }
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
}
public 
weaponmenuid ) {
 if( 
get_pcvar_num(plugin_on) == ) {
  
  new 
menu menu_create"Choose your weapon""weapon_handler");
  
  
menu_additem(menu"MP5NAVY""1"0);
  
menu_additem(menu"AWP""2"0);
  
menu_additem(menu"SCOUT""3",0);
  
  
menu_setprop(menuMPROP_EXITMEXIT_ALL);
  
menu_display(idmenu0);
 }
}
public 
weapon_handler(idmenuitem) {
 if (
item == MENU_EXIT) {
  
menu_destroy(menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
data[6], iName[64]
 new 
accesscallback
 
 menu_item_getinfo
(menuitemaccessdata,5iName63callback)
 
 new 
key str_to_num(data)
 switch( 
key ) {
  case 
1: {    
   new 
money cs_get_user_money(id);
   
   if (
money >= get_pcvar_num(mp5price)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(mp5price));
    
client_print(idprint_chat"%s You have selected MP5NAVY Weapon."Prefix
    
give_item(id "weapon_mp5navy");
    
give_item(id "ammo_9mm");
    
give_item(id "ammo_9mm");
    
give_item(id "ammo_9mm");
    
give_item(id "weapon_hegrenade");
    } else {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
  
  case 
2:{
   new 
money cs_get_user_money(id);
   
   if (
money >= get_pcvar_num(awpprice)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(awpprice));    
    
client_print(idprint_chat"%s You have selected AWP Weapon"Prefix)
    
give_item(id ,"weapon_awp");
    
give_item(id ,"ammo_338magnum");
    
give_item(id ,"ammo_338magnum");
    
give_item(id ,"ammo_338magnum");
    
give_item(id "weapon_hegrenade");
    } else {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
  
  case 
3:{ 
   new 
money cs_get_user_money(id);
   
   if (
money >= get_pcvar_num(scoutprice)) {
    
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(scoutprice));    
    
client_print(idprint_chat"%s You have choose SCOUT Weapon"Prefix)
    
give_item(id "weapon_scout");
    
give_item(id "ammo_762nato");
    
give_item(id "ammo_762nato");
    
give_item(id "ammo_762nato");
    
give_item(id "ammo_762nato");
    
give_item(id "weapon_hegrenade");
    }  else  {
    
client_print(id ,print_chat"%s You do not have enough money.WORK HARD!!"Prefix)
   }
  }
 }
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
}

public 
message(id)
{
    
client_print(id print_chat "%s Write /stats to get your stats."Prefix)
    
client_print(id print_chat "%s Also write /weapon tu buy weapon set."Prefix)
}

public 
client_putinserver()
{
    if(
is_user_alive(0))
    
    
set_task20.0 "message" "" "a" 2)

I choose the gravity stat,but had no effect.Speed stat also no effect

Get warning on compile.

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Warning: Tag mismatch on line 92
Warning: Tag mismatch on line 128
Header size:            756 bytes
Code size:             6844 bytes
Data size:             5444 bytes
Stack/heap size:      16384 bytes; estimated max. usage=781 cells (3124 bytes)
Total requirements:   29428 bytes

2 Warnings.
Done.
__________________
~ +karma to me and leave your name. ~
~ If you -karma to me,please leave your name so I know you are pro scripter. ~
~ Helping anytime ~


ianglowz is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 01-23-2009 , 19:00   Re: Float on pcvar problem.
Reply With Quote #2

Use get_pcvar_float
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ianglowz
Senior Member
Join Date: Nov 2008
Old 01-23-2009 , 19:00   Re: Float on pcvar problem.
Reply With Quote #3

Thanks,I don't know about that.
__________________
~ +karma to me and leave your name. ~
~ If you -karma to me,please leave your name so I know you are pro scripter. ~
~ Helping anytime ~


ianglowz 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:39.


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