AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Decreasing a value (https://forums.alliedmods.net/showthread.php?t=10519)

v3x 02-21-2005 19:41

Decreasing a value
 
Hey, I have this code right here:
Code:
new deaths = cs_get_user_deaths(id) new deaths2 = deaths - 1 cs_set_user_deaths(id,deaths2)

But it doesn't decrease the deaths.

Any help?

xeroblood 02-21-2005 20:00

As far as I know, it only changes the ScoreBoard the following round...

Maybe it works for you, just wait till next round and look at your score then?

v3x 02-21-2005 20:18

I did, lol.

Sp4rt4n 02-21-2005 21:31

im not sure if this would work, but you could do something like this..

(NOTE: Code may not be right... i am a very new person to Small)

Code:
new deaths = cs_get_user_deaths(id) new deaths2 = deaths-- cs_set_user_deaths(id,deaths2)

the deaths-- will decrease the users deaths by 1

lemmie know if it works

Freecode 02-22-2005 01:52

or do this
Code:
cs_set_user_deaths(id,cs_get_user_deaths(id) - 1)

XxAvalanchexX 02-22-2005 16:08

That's all the same code only in different styles, I don't see how that helps contribute to the solving of the man's problem.

Sp4rt4n 02-22-2005 16:10

Re: Decreasing a value
 
He said this doesnt decrease the deaths:

Quote:

Originally Posted by v3x
Hey, I have this code right here:
Code:
new deaths = cs_get_user_deaths(id) new deaths2 = deaths - 1 cs_set_user_deaths(id,deaths2)

so i told him to try it this way... this is how i learned it would work in C++:

Code:
new deaths = cs_get_user_deaths(id) new deaths2 = deaths-- cs_set_user_deaths(id,deaths2)

XxAvalanchexX 02-22-2005 16:15

Spartan, yours will decrease the value of deaths but return the old value. You woud need to use --deaths to get the new value.

v3x 02-22-2005 17:39

So what would work?? I'm confused :(.

Johnny got his gun 02-22-2005 18:16

Freecode's way is the way to go. Score on scoreboard SHOULD be updated as this is included in this native. If it doesn't something is wrong.


All times are GMT -4. The time now is 14:09.

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