Position returns 0.0
#1

Hello everyone, continuing to my system, I'm trying to fix a weird glitch that appeared however, I'm clueless to how this occurs.

pawn Код:
gSomeEnum[ID][E_POSX] // FLOAT OF COURSE.
Now unformat (from sscanf2) will unformat a string inside a file and read the values. It'll then set the value of "E_POSX" to it. This works <<<<<

Will print out:
pawn Код:
1573.3762
After I go to OnPlayerSpawn and type
pawn Код:
SetPlayerPos(playerid, gSomeEnum[ID][E_POSX], ..., ...);
and
pawn Код:
printf("%f", gSomeEnum[ID][E_POSX]):
it will take me to 0.0, 0.0, 0.0 and also! prints "0.0" or would say, Stay within the boundaries! and freeze my screen / overlay crap.

Something in my script is doing it wrongly, i'm not sure.

Does anyone have a clue to what this can be caused from? Thanks!
Reply
#2

If you're using the SA-MP 0.3d, that might cause it
Reply
#3

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
If you're using the SA-MP 0.3d, that might cause it
Of course I am though, it seemed to work fine before.
Reply
#4

I thought only the "u" parameter was broke in 0.3d? @OP: Do you use the "e" (enum) specifier to read the data?
Reply
#5

Make sure the data isn't reset elsewhere. + It could be [ID] mix-up.
Show us your sscanf line.
EDIT: To the poster below: We know. There were threads about that.
Anyways try setting the pos instantly after loading the data.
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
I thought only the "u" parameter was broke in 0.3d? @OP: Do you use the "e" (enum) specifier to read the data?
Are you sure that only "u" is broken? Maybe unformatting might be broken too, who knows.
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
I thought only the "u" parameter was broke in 0.3d? @OP: Do you use the "e" (enum) specifier to read the data?
Nah, mines different. Doesn't contain a single letter with "u"

EDIT: It's got nothing to do with sscanf FFS.

Something inside the ENUM is making it like this.
Reply
#8

Unsure, try printing it out several times throughout the script to find out where it changes.

Edit: Change all of the id floats and set a different ID per one and then you can see if the ids are mixed up.
Reply
#9

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Unsure, try printing it out several times throughout the script to find out where it changes.

Edit: Change all of the id floats and set a different ID per one and then you can see if the ids are mixed up.
Completely all of them are set to 0.0..

I'll try re-write the system
Reply
#10

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Completely all of them are set to 0.0..

I'll try re-write the system
Yes, the reason why it is probably printing 0.00 is because it's using the wrong id, Like I said set all the others to some random number then you can check if they are getting mixed up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)