SA-MP Forums Archive
[Help] Small bug - 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: [Help] Small bug (/showthread.php?tid=283618)



[Help] Small bug - Twinki1993 - 15.09.2011

Alright. So I am using LSL script, just for fun, and this is the problem. The cars are not saving. I tried to /v park the car and it showed me msg that it's park position has been saved but the car itself won't respawn there.
Please help me...

Code:
Код:
new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
	if(PlayerVehicleInfo[playerid][playervehicleid][pvId] != INVALID_PLAYER_VEHICLE_ID)
	{
		 new Float:oldx, Float:oldy, Float:oldz;
		 oldx = PlayerVehicleInfo[playerid][playervehicleid][pvPosX];
		 oldy = PlayerVehicleInfo[playerid][playervehicleid][pvPosY];
		 oldz = PlayerVehicleInfo[playerid][playervehicleid][pvPosZ];
		 if(oldx == newx && oldy == newy && oldz == newz) return 0;
		 PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = newx;
		 PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = newy;
		 PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = newz;
		 PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = newangle;
		 DestroyVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvId]);
		 new carcreated = CreateVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvModelId], PlayerVehicleInfo[playerid][playervehicleid][pvPosX], PlayerVehicleInfo[playerid][playervehicleid][pvPosY], PlayerVehicleInfo[playerid][playervehicleid][pvPosZ],
		 PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle],PlayerVehicleInfo[playerid][playervehicleid][pvColor1], PlayerVehicleInfo[playerid][playervehicleid][pvColor2], 6000000);
         PlayerVehicleInfo[playerid][playervehicleid][pvId] = carcreated;
         return 1;
	}
	return 0;
}
I think it's that.

Or it's this:
http://pastebin.com/FfBBPN36


Re: [Help] Small bug - Twinki1993 - 16.09.2011

BUMP:
I really need help, please!


Re: [Help] Small bug - =WoR=Varth - 16.09.2011

To get vehicles pos, you have to use https://sampwiki.blast.hk/wiki/Function:GetVehiclePos


Re: [Help] Small bug - Twinki1993 - 16.09.2011

Thanks but still I dont get it. How to set it to save normaly o.o


Re: [Help] Small bug - =WoR=Varth - 16.09.2011

pawn Код:
GetVehiclePos(vehicleid,PlayerVehicleInfo[playerid][playervehicleid][pvPosX],PlayerVehicleInfo[playerid][playervehicleid][pvPosY],PlayerVehicleInfo[playerid][playervehicleid][pvPosZ]);