Not loading correctly?
#1

I have this to save:

pawn Код:
new Float:X, Float:Y, Float:Z, Float:A, IntID, World;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        IntID = GetPlayerInterior(playerid);
        World = GetPlayerVirtualWorld(playerid);
        format(Msg, sizeof(Msg), "You Have Set A New Spawn Location. ** X: (%0.2f) Y: (%0.2f) Z: (%0.2f) Angle: (%.2f) Interior: (%d) World: (%d)**",X, Y, Z, A, IntID, World);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, Msg);

        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnX",         floatround( X ) );
        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnY",         floatround( Y ) );
        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnZ",         floatround( Z ) );
        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnAngle",     floatround( A ) );
        dUserSetINT     ( PlayerName2( playerid ) ).( "SpawnInterior",  IntID );
        dUserSetINT     ( PlayerName2( playerid ) ).( "SpawnWorld",     World );
And this is when it loads ( OnPlayerSpawn ):

pawn Код:
SetPlayerPos            (playerid, dUserINT(PlayerName2(playerid)).("SpawnX"), dUserINT(PlayerName2(playerid)).("SpawnY"), dUserINT(PlayerName2(playerid)).("SpawnZ"));
        SetPlayerInterior       (playerid, dUserINT(PlayerName2(playerid)).("SpawnInterior"));
        SetPlayerVirtualWorld   (playerid, dUserINT(PlayerName2(playerid)).("SpawnWorld"));
        SetPlayerFacingAngle    (playerid, dUserINT(PlayerName2(playerid)).("SpawnAngle"));
The problem is that it does not set the player's Interior correctly.
Reply
#2

Well everything appart from the loading of the floats looks fine to me.

pawn Код:
SetPlayerPos            (playerid, dUserINT(PlayerName2(playerid)).("SpawnX"), dUserINT(PlayerName2(playerid)).("SpawnY"), dUserINT(PlayerName2(playerid)).("SpawnZ"));
SetPlayerFacingAngle    (playerid, dUserINT(PlayerName2(playerid)).("SpawnAngle"));
Should technically be

pawn Код:
SetPlayerPos            (playerid, dUserFloat(PlayerName2(playerid)).("SpawnX"), dUserFloat(PlayerName2(playerid)).("SpawnY"), dUserFloat(PlayerName2(playerid)).("SpawnZ"));
SetPlayerFacingAngle    (playerid, dUserFloat(PlayerName2(playerid)).("SpawnAngle"));
Since that data is a float and not an integer.

I actually see that for some reason you use floatround on the floats? Why do you do that? Especially when you're storing them as a float anyway.

pawn Код:
dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnX",         X  );
        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnY",          Y  );
        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnZ",          Z  );
        dUserSetFLOAT   ( PlayerName2( playerid ) ).( "SpawnAngle",      A  );
Is what it should be when storing a float.
Reply
#3

lol, it worked fine with INT, and ye i didn't noticed that D: and btw, dUserFLOAT*

btw, still doesn't work. :/

When i save, it does print the correct interior id, but won't load it ;o
Reply
#4

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
lol, it worked fine with INT, and ye i didn't noticed that D: and btw, dUserFLOAT*

btw, still doesn't work. :/

When i save, it does print the correct interior id, but won't load it ;o
Well print the output of the original "Msg" and also make another printf for when you're spawning with all of the same information in it, and compare them, see what's wrong
Reply
#5

Output:

Код:
[19:48:56] You Have Set A New Spawn Location. ** X: (-1460.41) Y: (1589.93) Z: (1052.75) Angle: (356.01) Interior: (14) World: (0)**
[19:49:05] Spawned, X: -1460.000000, Y: 1590.000000, Z: 1053.000000, Angle: 0.000000, Interior: 0, World: 1135738880
Reply
#6

BBBBUUUUUUMPPPY BUMP BUMP!!!!
Reply
#7

Bump!

"The message you have entered is too short. Please lengthen your message to at least 8 characters."
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)