Raised This Month: $ Target: $400
 0% 

error: Expected token: ";", but found ")"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stigma
Senior Member
Join Date: Mar 2005
Location: Denmark
Old 04-05-2005 , 11:45   error: Expected token: ";", but found ")"
Reply With Quote #1

Why do i get theese errors when i compile?:

( 48 ) error: invalid expression, assumed zero
( 48 ) error: expected token ";", but found ")"
( 48 ) error: invalid expression, assumed zero

Code:
public healSm(id) {                         // Line 46                                          // Line 47     if (uMoney > 2000) {       // Line 48             if (uHealth < 50) {             set_user_health(id,uHealth)+30             client_print(id,print_chat,"[Medic] You bought a small medickit! + 30HP")                 }             }     if(uMoney < 2000) {                 client_print(id,print_chat,"[Medic] You don't have enough money")             }     if(uHealth > 50) {         client_print(id,print_chat,"[Medic] You'r health has to be below 50")             }     return PLUGIN_HANDLED     }
stigma is offline
Send a message via MSN to stigma Send a message via Skype™ to stigma
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 04-05-2005 , 11:48  
Reply With Quote #2

here's your problem:

Code:
set_user_health(id,uHealth)+30
should be
Code:
set_user_health(id,uHealth+30)

change it and try then
FeuerSturm is offline
stigma
Senior Member
Join Date: Mar 2005
Location: Denmark
Old 04-05-2005 , 11:51  
Reply With Quote #3

Thx dude! - And what a fast reply! almost like msn :p

Edit: Nope that change dident help... :/
stigma is offline
Send a message via MSN to stigma Send a message via Skype™ to stigma
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 04-05-2005 , 11:55  
Reply With Quote #4

show me the whole code of the plugin please, best would be the complete sma.
FeuerSturm is offline
stigma
Senior Member
Join Date: Mar 2005
Location: Denmark
Old 04-05-2005 , 11:59  
Reply With Quote #5

Okay then you can help me with the register_menucmd stuff then, i have troubles with that too.. ;)
Attached Files
File Type: sma Get Plugin or Get Source (healmenu.sma - 874 views - 3.2 KB)
stigma is offline
Send a message via MSN to stigma Send a message via Skype™ to stigma
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 04-05-2005 , 12:07  
Reply With Quote #6

you should review the register_menucmd function in the docs
and using #define with a native which acts with a player index is not really
a good idea.
you could combine all those functions where you need uMoney and uHealth
into one big function and simply use

Code:
new uMoney = cs_get_user_money(id) new uHealth = get_user_health(id)

then you won't have any problems anymore.
FeuerSturm is offline
stigma
Senior Member
Join Date: Mar 2005
Location: Denmark
Old 04-05-2005 , 12:09  
Reply With Quote #7

Dont really understand, cant you make the script to work, then send it as an .sma file? Then i can see the changes...
stigma is offline
Send a message via MSN to stigma Send a message via Skype™ to stigma
FeuerSturm
AlliedModders Donor
Join Date: Apr 2004
Old 04-05-2005 , 12:14  
Reply With Quote #8

i actually just have 2 minutes left until i'm off to a party
and those changes would take much longer time.

the easiest for now would be to remove that #define stuff and add

Code:
new uMoney = cs_get_user_money(id) new uHealth = get_user_health(id)
into any of your heal functions, like this:

Code:
public healSm(id) { new uMoney = cs_get_user_money(id) new uHealth = get_user_health(id)         if (uMoney > 2000) {             if (uHealth < 50) {             set_user_health(id,uHealth+30)             client_print(id,print_chat,"[Medic] You bought a small medickit! + 30HP")                 }             }     if(uMoney < 2000) {                 client_print(id,print_chat,"[Medic] You don't have enough money")             }     if(uHealth > 50) {         client_print(id,print_chat,"[Medic] You'r health has to be below 50")             }     return PLUGIN_HANDLED     }
FeuerSturm 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 10:02.


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