LoadPos PROBLEM ? - 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: LoadPos PROBLEM ? (
/showthread.php?tid=208890)
LoadPos PROBLEM [SOLVED] -
park4bmx - 09.01.2011
ALL SOLVED
Re: LoadPos PROBLEM ? -
JaTochNietDan - 09.01.2011
Okay there's some syntax errors here in your code, first of all this:
pawn Код:
dini_IntSet(file,"posx", PlayerInfo[playerid][posx]= x);
dini_IntSet(file,"posy", PlayerInfo[playerid][posy]= y);
dini_IntSet(file,"posz", PlayerInfo[playerid][posz]= z);
I don't know what you're trying to do here, but I suggest doing this:
pawn Код:
PlayerInfo[playerid][posx] = x;
PlayerInfo[playerid][posy] = y;
PlayerInfo[playerid][posz] = z;
dini_FloatSet(file,"posx", PlayerInfo[playerid][posx]);
dini_FloatSet(file,"posy", PlayerInfo[playerid][posy]);
dini_FloatSet(file,"posz", PlayerInfo[playerid][posz]);
You should also be using FloatSet instead of IntSet, as otherwise it won't record it properly.
Next is here:
pawn Код:
PlayerInfo[playerid][posx] == x;
PlayerInfo[playerid][posx] == y;
PlayerInfo[playerid][posx] == z;
== is a check operator it means to check if something is equal to something, it is not used in assigning a value to a variable.
= is used in assigning a value to a variable, so therefore the correct code is:
pawn Код:
PlayerInfo[playerid][posx] = x;
PlayerInfo[playerid][posx] = y;
PlayerInfo[playerid][posx] = z;
I recommend you take another read through the Pawn manual, assuming you already have, and make sure you're aware of the Pawn syntax
Re: LoadPos PROBLEM ? -
Alex_Valde - 09.01.2011
Hmm, it's weird that you even can save it because Players position is defined with Floats that means that a decimal number so you can't save it with "dini_IntSet" you should use "dini_FloatSet(file,"posx", PlayerInfo[playerid][posx]);" and so on... and when you load it you should use "dini_Float(file, "posx");"
Edit: Anyways, you got your answer explained perfectly by JaTochNietDan
Re: LoadPos PROBLEM ? -
Mr.Stranger - 09.01.2011
use this instead
pawn Код:
new float:LogX,float:LogY,float:LogZ;
GetPlayerPos(playerid, LogX,LogY,LogZ);
PlayerInfo[playerid][logpositionX] = LogX;
PlayerInfo[playerid][logpositionX] = Log,Y;
PlayerInfo[playerid][logpositionX] = LogZ;
if(!PlayerInfo[playerid][logposition]= 0)
{
new LogX = PlayerInfo[playerid][logpositionX];
new LogY = PlayerInfo[playerid][logpositionY];
new LogZ = PlayerInfo[playerid][logpositionZ];
SetPlayerPost(playerid,LogX,LogY,LogZ);
}
Re: LoadPos PROBLEM ? -
park4bmx - 09.01.2011
Thanks alot i learned a new thing today
But only a few
WARNINGS if u could help me out ?
pawn Код:
warning 213: tag mismatch
warning 213: tag mismatch
warning 213: tag mismatch
Error in this LINE
pawn Код:
PlayerInfo[playerid][posx] = x;
PlayerInfo[playerid][posx] = y;
PlayerInfo[playerid][posx] = z;
Re: LoadPos PROBLEM ? -
Alex_Valde - 09.01.2011
You need to use this:
pawn Код:
x = PlayerInfo[playerid][posx];
y = PlayerInfo[playerid][posx];
z = PlayerInfo[playerid][posx];
Because you are giving the x,y and z value and you can't give a value to "PlayerInfo[playerid][posx]" 'cause x is not an float nor int so...Try it should be right.
Re: LoadPos PROBLEM ? -
park4bmx - 09.01.2011
Quote:
Originally Posted by Alex_Valde
You need to use this:
pawn Код:
x = PlayerInfo[playerid][posx]; y = PlayerInfo[playerid][posx]; z = PlayerInfo[playerid][posx];
Because you are giving the x,y and z value and you can't give a value to "PlayerInfo[playerid][posx]" 'cause x is not an float nor int so...Try it should be right.
|
And Thanks again Worked
)