SA-MP Forums Archive
SetVehiclePos question. - 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: SetVehiclePos question. (/showthread.php?tid=71491)



SetVehiclePos question. - HB - 01.04.2009

Well I'm getting like FRUSTRATED now on this bug, I tried everything like adding random numbers and shit. What is wrong with this code:
Код:
new Float:X, Float:Y, Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	SetVehiclePos(pInfo[playerid][OwnCar],X,Y,Z);
	SendClientMessage(playerid,c_green,"You have teleported your car to your position.");
	#pragma unused params
	return 1;
Neither "pInfo[playerid][OwnCar]" replacing by a random number nor changing the code a bit so you get another array, it wont work..

Any help?

Edit:
Tried changing the array again, worked now o.O I guess I have to try another way calling this vehicle, nevermind this all!


Re: SetVehiclePos question. - Rks25 - 01.04.2009

adjust the z.


Re: SetVehiclePos question. - Pyrokid - 01.04.2009

Quote:
Originally Posted by Rk_
adjust the z.
Quote:
Originally Posted by иєσz
Tried changing the array again, worked now o.O I guess I have to try another way calling this vehicle, nevermind this all!



Re: SetVehiclePos question. - HB - 01.04.2009

I forgot to mention what is wrong with this.. Well it just doesn't work. It sends the ClientMessage, thats all.

Now I adjusted the code a little bit.. And it still doesn't work.
Код:
new Float:X, Float:Y, Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	SetVehiclePos(cInfo[pInfo[playerid][OwnCar]][Vehicle],X,Y,Z);
	SendClientMessage(playerid,c_green,"You have teleported your car to your position.");
cInfo[carid][Vehicle] is the CreateVehicle line, pInfo[playerid][OwnCar] can be seen as the car id. Same problem as above.


Re: SetVehiclePos question. - ICECOLDKILLAK8 - 01.04.2009

SetVehiclePos isnt synced, The best thing to do is store thier position to a variable, Put them in thier car, Then TP them and thier car back to the original position, Like this
pawn Код:
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);
PutPlayerInVehicle(playerid, pInfo[playerid][OwnCar], 0);
SeVehiclePos(pInfo[playerid][OwnCar], X, Y, Z);
SendClientMessage(playerid,c_green,"You have teleported your car to your position.");



Re: SetVehiclePos question. - HB - 01.04.2009

Quote:
Originally Posted by JeNkStAX
SetVehiclePos isnt synced, The best thing to do is store thier position to a variable, Put them in thier car, Then TP them and thier car back to the original position.
How come it works with a different array? I tried Car[playerid] as CreateVehicle line, that worked fine?


Re: SetVehiclePos question. - ICECOLDKILLAK8 - 01.04.2009

When you spawn the car its position is synced, But after spawn you cant set its position without it being unsynced


Re: SetVehiclePos question. - HB - 01.04.2009

Quote:
Originally Posted by JeNkStAX
When you spawn the car its position is synced, But after spawn you cant set its position without it being unsynced
I still don't get it. You mention its desynch while it has nothing to do with it. I had the array Vehicle[playerid] as CreateVehicle line, this worked fine with SetVehiclePos in another command. When I use cInfo[carid][Vehicle] as CreateVehicle line, it won't work? Is this some bug in my system? Because I tried kind of the same thing now with Vehicle[carid] and it didn't work. Maybe its because of the playerid and carid difference?

Help!


Re: SetVehiclePos question. - ICECOLDKILLAK8 - 01.04.2009

I have never managed to get SetVehiclePos to sync so idk how you did it


Re: SetVehiclePos question. - HB - 02.04.2009

Quote:
Originally Posted by иєσz
You mention its desynch while it has nothing to do with it.
Edit: I saw you edited your code, this might work. My apologies, I was a bit rushed yesterday so I didn't see it.

Edit2: It works, thanks.