AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   error: Expected token: ";", but found ")" (https://forums.alliedmods.net/showthread.php?t=12113)

stigma 04-05-2005 11:45

error: Expected token: ";", but found ")"
 
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     }

FeuerSturm 04-05-2005 11:48

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 :wink:

stigma 04-05-2005 11:51

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

Edit: Nope that change dident help... :/

FeuerSturm 04-05-2005 11:55

show me the whole code of the plugin please, best would be the complete sma.

stigma 04-05-2005 11:59

1 Attachment(s)
Okay then you can help me with the register_menucmd stuff then, i have troubles with that too.. ;)

FeuerSturm 04-05-2005 12:07

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.

stigma 04-05-2005 12:09

Dont really understand, cant you make the script to work, then send it as an .sma file? Then i can see the changes...

FeuerSturm 04-05-2005 12:14

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     }


All times are GMT -4. The time now is 10:02.

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