floatround help and more... -
LarzI - 01.04.2009
Firstly, here's my code
http://ampaste.net/m4b466c9d
(used boyletts auto-indenter, since pastebin fucks up indentation)
As you've maybe already seen, I'm making a rockthevote FS, just like the plugin(s) for AmxModX (CS)...
But this part doesn't get called
pawn Код:
if(rockedVotes == intfloat(floatround(playerCount2, floatround_ceil)))
{
SendClientMessageToAll(COLOR_GREEN, "Vote is now rocked!");
SendClientMessageToAll(COLOR_GREEN, "Voting will begin soon!");
SetTimer("startVote", 10*1000, false);
rockedVotes = 0;
voteIsRocked = 1;
return true;
}
I've tried with only 1 player, but...
rockedVotes is 1 (since only 1 player has rocked the vote)
floatround(playerCount2 is 1 too, since 1 / 10 * 5 = 0.5 and if we use the method floatround_ceil (as I've tested in a simple script too) it turns into 1...
then rockedVotes and floatround(player.... is equal, but still the code doesn't get called (and the floatround thingy doesn't return like 1.000000, it returns 1)
Any help? I really need this
Re: floatround help and more... -
Eraz0r - 01.04.2009
I'm not sure, but can u compare floats with == ?
Maybe u habe to use floatcmp() ?
Re: floatround help and more... -
LarzI - 01.04.2009
as I said, it did return 1, not 1.0000, so I really dno :S
please some pros tell me
Re: floatround help and more... -
Eraz0r - 01.04.2009
Quote:
Originally Posted by lrZ^ aka LarzI
as I said, it did return 1, not 1.0000, so I really dno :S
please some pros tell me
|
arg that was stupid of me -.- sry ^^
Re: floatround help and more... -
LarzI - 01.04.2009
Updated first post with new code.
Really need this guys!
Please help!!!!!
EDIT: I kinda fixed it...
I needed to define lots of stuff, so if you know how to get this method to work, please try to help
(what I want is the player count divided by two to be the needed votes, but since it's not possible to give a half vote, this is kinda impossible)
Re: floatround help and more... -
13th - 01.04.2009
What is the difference between 1 and 1.0000 ?
if you print float 1.000 it still shows up as 1.
And also, playerCount2 is an integer point, not a float value. So.. you can't really round it.
EDIT: Sorry.. the float 1.0000 prints 1.0000, not 1
You still need to make playerCount2 into a float value for it to work..
Re: floatround help and more... -
ICECOLDKILLAK8 - 02.04.2009
When i was doing a script floatround wasnt what i needed so i ended up formating 2 strings with just "%01f", Then used use strval to round them then treated them as normal integers
Re: floatround help and more... -
LarzI - 02.04.2009
Just want to tell you what I really want, and what I got...
What I want:
To get all players, then needed votes is 50% of the number of players, but if the result is like 1.5 60.5 etc, I want it to be 2 instead of 1.5 and 61 instead of 60.5 (increase with 0.5)
What I got:
Just setting 1-10 players decreases with 2, 11-20 increases with 5 etc... (can't remember it all)
As you maybe see, what I got is kinda unefficient, I would really like to get what I want..
So please help if you can (or find an even better way)