/park command saving problem?
#1

I'm using a car filterscript and inside of the filterscript, this is the /park command.

Код:
else if (strcmp("/park", cmd, true, 10) == 0)
	{
		if (IsPlayerInVehicle(playerid,Carlist[playerid][Carid]))
		{
		    GetVehiclePos(Carlist[playerid][Carid],Carlist[playerid][X],Carlist[playerid][Y],Carlist[playerid][Z]);
		    GetVehicleZAngle(Carlist[playerid][Carid],Carlist[playerid][Rotation]);
		    SendClientMessage(playerid, COLOR_GREEN, "Saved car position!");
		}
		else { SendClientMessage(playerid, COLOR_GREY, "That is not your car!"); }
		return 1;
	}
When the /park command is typed, it says it saved the car's position. But when the car blows up or you relog, the car isn't there nor is it at the car dealership. I need help to fix this portion of the code up so it saves the when it blows up or the player relogs and they can find it where they last /park'ed it.
Reply
#2

pawn Код:
new vehicle = GetPlayerVehicle(playerid), Float:vx, Float:vy, Float:vz, Float:vangle, filestr[100];
GetVehiclePos(vehicle, vx, vy, vz);
GetVehicleZAngle(vehicle, vangle);
vehicle = Carlist[playerid][Carid];
vx = Carlist[playerid][X];
vy = Carlist[playerid][Y];
vz = Carlist[playerid][Z];
vangle = Carlist[playerid][Rotation];


public OnVehicleStreamIn(vehicleid, forplayerid)
{
    SetVehiclePos(Carlist[playerid][Carid], Carlist[playerid][X], Carlist[playerid][Y], Carlist[playerid][Z]);
    SetVehicleZAngle(Carlist[playerid][Carid], Carlist[playerid][Rotation]);
    return 1;
}
Try this ^^
Basically you forgot to store the new locations into the Carlist, while you used SetVehiclePos(Carlist, etc.. at the command, you should get the position first, not those who are in the file already
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)