SA-MP Forums Archive
GetPVarFloat, SetPVarFloat problems - 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: GetPVarFloat, SetPVarFloat problems (/showthread.php?tid=185644)



GetPVarFloat, SetPVarFloat problems - Maeglin - 25.10.2010

Hi there ! I'm using PVars because i think it's very practical.

I'm using this code:

pawn Код:
yazi = "SpawnX";
    SetPVarFloat ( oid, yazi, PlayerBilgiFloat ( username, yazi, deger3 ) );
    yazi = "SpawnY";
    SetPVarFloat ( oid, yazi, PlayerBilgiFloat ( username, yazi, deger3 ) );
    yazi = "SpawnZ";
    SetPVarFloat ( oid, yazi, PlayerBilgiFloat ( username, yazi, deger3 ) );
    yazi = "SpawnA";
    SetPVarFloat ( oid, yazi, PlayerBilgiFloat ( username, yazi, deger3 ) );
    yazi = "SpawnI";
    SetPVarInt ( oid, yazi, PlayerBilgiInt ( username, yazi, deger2 ) );
    yazi = "SpawnW";
    SetPVarInt ( oid, yazi, PlayerBilgiInt ( username, yazi, deger2 ) );
but somethings are going to wrong.

When I use it:

pawn Код:
new Float: SpawnX, Float: SpawnY, Float: SpawnZ, Float: SpawnA, SpawnI, SpawnW;
   
    SpawnX = GetPVarFloat ( oid, "SpawnX" );
    SpawnY = GetPVarFloat ( oid, "SpawnY" );
    SpawnZ = GetPVarFloat ( oid, "SpawnZ" );
    SpawnA = GetPVarFloat ( oid, "SpawnA" );
    SpawnI = GetPVarInt ( oid, "SpawnI" );
    SpawnW = GetPVarInt ( oid, "SpawnW" );
   
    printf("PLAYERLOAD2 // SpawnX: %f  SpawnY: %f  SpawnZ: %f  SpawnA: %f  SpawnI: %d  SpawnW: %d",
           SpawnX,
           SpawnY,
           SpawnZ,
           SpawnA,
           SpawnI,
           SpawnW);
This code's output is:

Код:
[18:35:04] PLAYERLOAD2 // SpawnX: 1142845824.000000  SpawnY: -1005641920.000000  SpawnZ: 1099083776.000000  SpawnA: 1132987392.000000  SpawnI: 0  SpawnW: 0
But It must be:

Код:
[18:35:04] PLAYERLOAD2 // SpawnX: 633.776000  SpawnY: -572.489013  SpawnZ: 16.335899  SpawnA: 272.032989  SpawnI: 0  SpawnW: 0
If I use it:

pawn Код:
printf("PLAYERLOAD // SpawnX: %f  SpawnY: %f  SpawnZ: %f  SpawnA: %f  SpawnI: %d  SpawnW: %d",
           PlayerBilgiFloat ( username, "SpawnX", deger3 ),
           PlayerBilgiFloat ( username, "SpawnY", deger3 ),
           PlayerBilgiFloat ( username, "SpawnZ", deger3 ),
           PlayerBilgiFloat ( username, "SpawnA", deger3 ),
           PlayerBilgiInt ( username, "SpawnI", deger2 ),
           PlayerBilgiInt ( username, "SpawnW", deger2 ));
This code's output is:

Код:
[18:35:04] PLAYERLOAD // SpawnX: 633.776000  SpawnY: -572.489013  SpawnZ: 16.335899  SpawnA: 272.032989  SpawnI: 0  SpawnW: 0
so true..

What's problem ?


Re: GetPVarFloat, SetPVarFloat problems - pater - 25.10.2010

here, try this:
pawn Код:
SpawnX = floatstr(GetPVarFloat ( oid, "SpawnX" ));
    SpawnY = floatstr(GetPVarFloat ( oid, "SpawnY" ));
    SpawnZ = floatstr(GetPVarFloat ( oid, "SpawnZ" ));
    SpawnA = floatstr(GetPVarFloat ( oid, "SpawnA" ));
    SpawnI = GetPVarInt ( oid, "SpawnI" );
    SpawnW = GetPVarInt ( oid, "SpawnW" );


pater


Re: GetPVarFloat, SetPVarFloat problems - Maeglin - 25.10.2010

(437) : error 035: argument type mismatch (argument 1)
(43 : error 035: argument type mismatch (argument 1)
(439) : error 035: argument type mismatch (argument 1)
(440) : error 035: argument type mismatch (argument 1)


Re: GetPVarFloat, SetPVarFloat problems - Maeglin - 25.10.2010

Anyone ?


Re: GetPVarFloat, SetPVarFloat problems - pater - 25.10.2010

I am sorry, i was wrong;
fixed and tested :

pawn Код:
new Float: SpawnX, Float: SpawnY, Float: SpawnZ, Float: SpawnA, Float:Thing[4], SpawnI, SpawnW;

    Thing[0] = GetPVarFloat(oid, "SpawnX");
    Thing[1] = GetPVarFloat(oid, "SpawnY");
    Thing[2] = GetPVarFloat(oid, "SpawnZ");
    Thing[3] = GetPVarFloat(oid, "SpawnA");
    SpawnI = GetPVarInt(oid, "SpawnI" );
    SpawnW = GetPVarInt(oid, "SpawnW" );
   
   
    printf("PLAYERLOAD2 // SpawnX: %f  SpawnY: %f  SpawnZ: %f  SpawnA: %f  SpawnI: %d  SpawnW: %d", Thing[0], Thing[1], Thing[2], Thing[3], SpawnI, SpawnW);
now gives result as float.

enjoy


Re: GetPVarFloat, SetPVarFloat problems - Maeglin - 25.10.2010

They are same.. You are using Float:Thing[], I'm using Float:Spawn.


Re: GetPVarFloat, SetPVarFloat problems - pater - 25.10.2010

no you use Float:SpawnX twice, for two different things


Re: GetPVarFloat, SetPVarFloat problems - Maeglin - 25.10.2010

Twice ? In where ?


Re: GetPVarFloat, SetPVarFloat problems - pater - 25.10.2010

pawn Код:
GetPVarFloat(oid, "SpawnX");
here you get the PVarFloat from SpawnX

and here:
pawn Код:
SpawnX = GetPVarFloat ( oid, "SpawnX" );
you name the PVarFloat of SpawnX again SpawnX:


Re: GetPVarFloat, SetPVarFloat problems - Maeglin - 25.10.2010

pawn Код:
new Float: Spawn[4], SpawnI, SpawnW;
   
    Spawn[0] = GetPVarFloat ( oid, "SpawnX" );
    Spawn[1] = GetPVarFloat ( oid, "SpawnY" );
    Spawn[2] = GetPVarFloat ( oid, "SpawnZ" );
    Spawn[3] = GetPVarFloat ( oid, "SpawnA" );
    SpawnI = GetPVarInt ( oid, "SpawnI" );
    SpawnW = GetPVarInt ( oid, "SpawnW" );
   
    printf("PLAYERLOAD2 // SpawnX: %f  SpawnY: %f  SpawnZ: %f  SpawnA: %f  SpawnI: %d  SpawnW: %d",
           Spawn[0],
           Spawn[1],
           Spawn[2],
           Spawn[3],
           SpawnI,
           SpawnW);
I'm taking error still..

The problem isn't variable names..