SetVehiclePos question.
#1

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

adjust the z.
Reply
#3

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!
Reply
#4

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

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.");
Reply
#6

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

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

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!
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)