Raised This Month: $ Target: $400
 0% 

Help with the "If" statement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Skeetles
BANNED
Join Date: Jul 2005
Old 03-19-2006 , 14:11   Help with the "If" statement
Reply With Quote #1

I feel like an idiot asking this question, but obviously I am not getting it right. PAWN must be different from VB and Java, here are my if statements that get 4 errors and 2 warnings.
Code:
if(get_cvar_num("amx_rpgbuy")="0")
Code:
if(omfg<4500)
//omfg = cs_get_user_money
Code:
if(hasRPG[id]=1 && nrop = "CSW_AWP")
Everything else should work and I am only getting errors/warnings on these three lines.
Skeetles is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 03-19-2006 , 14:16  
Reply With Quote #2

Code:
if(get_cvar_num("amx_rpgbuy") == 0)

Code:
if(hasRPG[id]=1 && equal(nrop, "CSW_AWP"))


Code:
if(omfg<4500)
Doesn't look like anything wrong here .. But you might of used the native wrong and giving you the error...


PS. Next Time give the error to
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 03-19-2006 , 14:17  
Reply With Quote #3

= is for assignment and == is for comparison
the second one is totaly fine
the third... you cannot compare strings using = (or == for that matter), check the string.inc
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Skeetles
BANNED
Join Date: Jul 2005
Old 03-19-2006 , 14:26  
Reply With Quote #4

Ok it all works except for this line:
Code:
    if(hasRPG[id]==1 && equal(nrop, "CSW_AWP"))
Argument type mismatch, argument 1

I guess I should have said
Code:
new nrop = cs_get_weapon_id (id)
but it still looks like it should work.
Skeetles is offline
Skeetles
BANNED
Join Date: Jul 2005
Old 03-19-2006 , 15:06  
Reply With Quote #5

What does cs_get_weapon_id return exactly? that might be the problem, sorry for the double post.
Skeetles is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-19-2006 , 15:09  
Reply With Quote #6

think it returns
Code:
CSW_P228
CSW_SCOUT		
CSW_HEGRENADE		
CSW_XM1014		
CSW_C4			
CSW_MAC10		
CSW_AUG			
CSW_SMOKEGRENADE	
CSW_ELITE		
CSW_FIVESEVEN		
CSW_UMP45		
CSW_SG550		
CSW_GALI		
CSW_GALIL		
CSW_FAMAS		
CSW_USP			
CSW_GLOCK18		
CSW_AWP			
CSW_MP5NAVY		
CSW_M249		
CSW_M3			
CSW_M4A1		
CSW_TMP			
CSW_G3SG1		
CSW_FLASHBANG		
CSW_DEAGLE		
CSW_SG552		
CSW_AK47		
CSW_KNIFE		
CSW_P90
wouter is offline
Skeetles
BANNED
Join Date: Jul 2005
Old 03-19-2006 , 15:19  
Reply With Quote #7

I am so glad I realised this, new wpnid = read_data(2)
cs_get_weapon_id won't work in this situation.
Skeetles is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 03-19-2006 , 22:27  
Reply With Quote #8

so....? you got it all working?
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
VEN
Veteran Member
Join Date: Jan 2005
Old 03-20-2006 , 04:26  
Reply With Quote #9

CSW_AWP is integer constant which defined in includes so nrop must be integer either and then that operation would be correct: nrop == CSW_AWP

If you want get current weapon id, use get_user_weapon
cs_get_weapon_id is for weapon entity id
VEN 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 16:39.


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