increment numeric variable

GameBoy
player startscript if ($name(#playerid#)$ = Squiggle ) then inc <hp[playerid]; 9900>

if anybody can find a fault in that, please correct it for me, coz it wont work... very odd. i might have $name(#playerid#)$ written wrong...

Cryophile
Where did you get #playerid#? I know of userid, which is an array. So it's %userid%. Such as $name(%userid%)$

GameBoy
Alex said its not userid its playerid but is it a string or a numeric variable? i dunno

Cryophile
It's playerid??? Now i'm confused... It should be a %% since it's a number.

GameBoy
yeah but i want it to find the player name not the player ID. i dont know, see what alex/Al/CW/ITID has to say lol, they're far more better than i

Cryophile
Check the manual. It says it is $name(userid)$
not playerid and there are no ## or %%.
just something like dec <health[userid];2>

GameBoy
yeah thats when decrementing a numberic variable belonging to the player, im just trying to see if the player name is set to squiggle before i give it godly powers.

Alex
Actually I said it WAS USERID NOT PLAYERID!

GameBoy
no u didnt!! lol. I showed you the code and asked why it wouldnt work, it said userid in it and you said "it needs playerid" lol.

Anyway, Alex, could you please correct my code so it will work, thanks for the help 8)

Alex
No, you had userid in one part and playerid in the other. See:


[23:46:49] !!!!PrOuD tO: i cant even get this right...
[23:46:50] !!!!PrOuD tO: player startscript if ( $name(%userid%)$ =
Squiggle ) then inc <hp[playerid]; 9900>
[23:46:50] Alex: duno...
[23:47:06] Alex: well it's userid not playerid .....



What code needs correcting now? Can't you try and work it out yourself for once... perhaps read the manual.........

GameBoy
see then completely confused me.... im supposedto change <hp[playerid]; 9900> to <hp[userid]; 9900>

Cryophile
that's what I thought to begin with. Are there %'s? I don't think so, but I would like confirmation.

kewldude606
no %s for the number vars in an array.

Cryophile
Right. But you can use %userid% by itself in a msg or something, I think.

GameBoy
$name(%userid%)$ displays the player name

Cryophile
S1aY3R wrote:Where did you get #playerid#? I know of userid, which is an array. So it's %userid%. Such as $name(%userid%)$


lol, I was right the first time. I was sooo confused by what you guys said. Oh well. At least we know now. Besides, since when am I right? Almost never, lol!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums