GetPVarFloat, SetPVarFloat problems
#1

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 ?
Reply
#2

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
Reply
#3

(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)
Reply
#4

Anyone ?
Reply
#5

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
Reply
#6

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

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

Twice ? In where ?
Reply
#9

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:
Reply
#10

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..
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)