Raised This Month: $ Target: $400
 0% 

Const problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zz870201
Junior Member
Join Date: Feb 2013
Old 07-22-2014 , 09:13   Const problem
Reply With Quote #1

Code:
new const i_NormalWeapon[][] = {"","weapon_mp5navy","weapon_ak47"}
new const i_WeaponPrice[][] = {"","1000","300"}

public giveweaponmp5(id){
    	give_item(id,i_NormalWeapon[1])
	new money = cs_get_user_money(id) - i_WeaponPrice[1][0]
	cs_set_user_money(id,money)
}
What wrong with it? I only spent 49$ for mp5....
zz870201 is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-22-2014 , 09:21   Re: Const problem
Reply With Quote #2

First of all, you're using Strings where you should use Integer values. And thats why it takes 49 only, as '1' is 49 in the ASCII representation.

PHP Code:
new const i_NormalWeapon[][] = {"","weapon_mp5navy","weapon_ak47"}
new const 
i_WeaponPrice[] = {0,1000,300}

public 
giveweaponmp5(id){
        
give_item(id,i_NormalWeapon[1])
    new 
money cs_get_user_money(id) - i_WeaponPrice[1]
    
cs_set_user_money(id,money)

Why is the first element of both arrays empty anyways?
mottzi is offline
Send a message via MSN to mottzi
zz870201
Junior Member
Join Date: Feb 2013
Old 07-22-2014 , 09:31   Re: Const problem
Reply With Quote #3

Quote:
Originally Posted by mottzi View Post
First of all, you're using Strings where you should use Integer values. And thats why it takes 49 only, as '1' is 49 in the ASCII representation.

PHP Code:
new const i_NormalWeapon[][] = {"","weapon_mp5navy","weapon_ak47"}
new const 
i_WeaponPrice[] = {0,1000,300}

public 
giveweaponmp5(id){
        
give_item(id,i_NormalWeapon[1])
    new 
money cs_get_user_money(id) - i_WeaponPrice[1]
    
cs_set_user_money(id,money)

Why is the first element of both arrays empty anyways?
hahaha......
Ok thank you!
zz870201 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 13:13.


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