SA-MP Forums Archive
SetPlayerPos not working properly! - 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)
+--- Thread: SetPlayerPos not working properly! (/showthread.php?tid=404818)



SetPlayerPos not working properly! - electrux - 04.01.2013

Hey all .
I have got a problem again.
When i use 'SetPlayerPos', it always teleports me to location 0.0000, 0.0000, 0.0000 (somewhere underground near farm, los santos). Heres the code:

Код:
new Float:px, Float:py, Float:pz, Float:aa;
px = dini_Float(file,"PosX");
py = dini_Float(file,"PosY");
pz = dini_Float(file,"PosZ");
aa = dini_Float(file,"Angle");
SetPlayerPos(playerid,px,py,pz);
SetPlayerFacingAngle(playerid,aa);
Everything is proper and file is opening and closing. And no warnings or errors.

P.S. I use dini cause i like it . So please dont tell about that.

Regards
Electrux


Re: SetPlayerPos not working properly! - Opah - 04.01.2013

show us your saving pos code and your teleport code in full


Re: SetPlayerPos not working properly! - electrux - 04.01.2013

Here is saving:

Код:
new file[50], Float:px, Float:py, Float:pz, Float:aa;
GetPlayerPos(playerid,px,py,pz);
GetPlayerFacingAngle(playerid,aa);
format(file,sizeof(file),"/implocations/%d.dat",index);
dini_Create(file);
dini_Set(file,"Name","Name");
dini_FloatSet(file,"PosX",px);
dini_FloatSet(file,"PosY",py);
dini_FloatSet(file,"PosZ",pz);
dini_FloatSet(file,"Angle",aa);
Here is loading:
Код:
CMD:teleporttoidfile(playerid,params[])
{
new index,file[50];
if(sscanf(params,"i",index)) return SCM(playerid,COLOR_RED,"Usage: teleporttoid [ID of file (like 0, 1, 2, 4 etc.)]");
format(file,sizeof(file),"/implocations/%d.dat",index);
new Float:px, Float:py, Float:pz, Float:aa;
px = dini_Float(file,"PosX");
py = dini_Float(file,"PosY");
pz = dini_Float(file,"PosZ");
aa = dini_Float(file,"Angle");
SetPlayerPos(playerid,px,py,pz);
SetPlayerFacingAngle(playerid,aa);
SCM(playerid,COLOR_RED,"Done!!");
return 1;
}