SA-MP Forums Archive
Not loading correctly? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Not loading correctly? (/showthread.php?tid=173274)



Not loading correctly? - [L3th4l] - 02.09.2010

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.


Re: Not loading correctly? - JaTochNietDan - 02.09.2010

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.


Re: Not loading correctly? - [L3th4l] - 02.09.2010

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


Re: Not loading correctly? - JaTochNietDan - 02.09.2010

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


Re: Not loading correctly? - [L3th4l] - 02.09.2010

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



Re: Not loading correctly? - [L3th4l] - 02.09.2010

BBBBUUUUUUMPPPY BUMP BUMP!!!!


Re: Not loading correctly? - [L3th4l] - 04.09.2010

Bump!

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