AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is this the correct syntax? (https://forums.alliedmods.net/showthread.php?t=29981)

TheNewt 06-19-2006 19:53

Is this the correct syntax?
 
Code:
        new health[33]         get_user_health(id, health, 32)         set_user_health(id, health + 150)         client_print(id, print_chat, "[Customs] You upgrade your health, its now at %i." health)
or
Code:
        new health[33] = get_user_health(id)         set_user_health(id, health + 150)         client_print(id, print_chat, "[Customs] You upgrade your health, its now at %i." health)
It is all very confusing to me.... >.<

wonsae 06-19-2006 19:54

2nd one.

TheNewt 06-19-2006 19:58

Code:

/home/users/amxmodx/tmp3/textmgEflP.sma(143) : error 088: number of arguments does not match definition
/home/users/amxmodx/tmp3/textmgEflP.sma(144) : error 033: array must be indexed (variable "health")
/home/users/amxmodx/tmp3/textmgEflP.sma(145) : error 001: expected token: ",", but found "-identifier-"
/home/users/amxmodx/tmp3/textmgEflP.sma(145) : warning 215: expression has no effect
/home/users/amxmodx/tmp3/textmgEflP.sma(145) : error 001: expected token: ";", but found ")"
/home/users/amxmodx/tmp3/textmgEflP.sma(145) : error 029: invalid expression, assumed zero
/home/users/amxmodx/tmp3/textmgEflP.sma(145) : fatal error 107: too many error messages on one line

eh... compiling errors with the second one... new health is 142, client print is 146... :( just something is wrong about that code... I'm gonna go check funcwiki again for the 20th time...

wonsae 06-19-2006 20:03

Lemme see the code.

Hawk552 06-19-2006 20:07

I think you're trying to do this:

Code:
 new health         get_user_health(id, health)         set_user_health(id, health + 150)         client_print(id, print_chat, "[Customs] You upgrade your health, its now at %i." health)

TheNewt 06-19-2006 20:15

Exactly
 
Yes Hawk, thats exactly what I was going for, I eventually got it before deciding to refresh the page, but I also tried compiling it before refreshing the page and I got some errrors... get_user_health(id, health + 150)

but i got this
Code:

: error 088: number of arguments does not match definition
when i tried compiling.

Hawk552 06-19-2006 20:16

Remove + 150

TheNewt 06-19-2006 20:30

Haha I'm smart, this worked!
Code:
        new oldhealth = get_user_health(id)         new newhealth = oldhealth + 150         set_user_health(id, newhealth)         client_print(id, print_chat, "[Customs] You upgrade your health, its now at %i.", newhealth)

Hawk552 06-19-2006 21:20

That's stupid, just make oldhealth = get_user_health(id) + 150

TheNewt 06-20-2006 00:28

Gives me a compiling error if I do that.


All times are GMT -4. The time now is 08:06.

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