SA-MP Forums Archive
CG-RP Broken Vehicle System .. - 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: CG-RP Broken Vehicle System .. (/showthread.php?tid=617894)



CG-RP Broken Vehicle System .. - BadScripter - 28.09.2016

I am working on "CG-RP" Gamemode but i found i serious bug on it ,
When you use /pv(parkvehicle) it's repair and set the car color to black also removes any modifications,Also when you re-log same happens ,basically the code build on "DestroyPlayerVehicle" and "CreatePlayerVehicle"
So can anyone help me to fix it "by any meaning" ,Your help will be appreciated !


Re: CG-RP Broken Vehicle System .. - Quinncell - 28.09.2016

Can you show me the /pv command?


Re: CG-RP Broken Vehicle System .. - BadScripter - 28.09.2016

Quote:
Originally Posted by KeithCooper
Посмотреть сообщение
Can you show me the /pv command?
Here it's
Код:
if(strcmp(cmd, "/parkvehicle", true) == 0 || strcmp(cmd, "/parkcar", true) == 0) // Parking the car.
	{
		new vehicleid = GetPlayerVehicleID(playerid);
	 	if(IsPlayerConnected(playerid))
	    {
			if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == 2)
			{
				GetPlayerVehicleMods(playerid);
				if(PlayerVehicleID1[playerid] == vehicleid)
				{
					GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX1], PlayerInfo[playerid][PlayerVehiclePosY1], PlayerInfo[playerid][PlayerVehiclePosZ1]);
    				GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing1]);
					DestroyVehicle(PlayerVehicleID1[playerid]);
					PlayerInfo[playerid][PlayerVehicle1VirWorld] = GetPlayerVirtualWorld(playerid);
            		PlayerInfo[playerid][PlayerVehicle1Interior] = GetPlayerInterior(playerid);
				    CreatePlayerVehicle(playerid,1);
					PutPlayerInVehicle(playerid,PlayerVehicleID1[playerid],0);
				}
				else if(PlayerVehicleID2[playerid] == vehicleid)
				{
					GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX2], PlayerInfo[playerid][PlayerVehiclePosY2], PlayerInfo[playerid][PlayerVehiclePosZ2]);
			       	GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing2]);
					DestroyVehicle(PlayerVehicleID2[playerid]);
					PlayerInfo[playerid][PlayerVehicle2VirWorld] = GetPlayerVirtualWorld(playerid);
            		PlayerInfo[playerid][PlayerVehicle2Interior] = GetPlayerInterior(playerid);
				    CreatePlayerVehicle(playerid,2);
					PutPlayerInVehicle(playerid,PlayerVehicleID2[playerid],0);
				}
				else if(PlayerVehicleID3[playerid] == vehicleid)
				{
					GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX3], PlayerInfo[playerid][PlayerVehiclePosY3], PlayerInfo[playerid][PlayerVehiclePosZ3]);
			       	GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing3]);
					DestroyVehicle(PlayerVehicleID3[playerid]);
					PlayerInfo[playerid][PlayerVehicle3VirWorld] = GetPlayerVirtualWorld(playerid);
            		PlayerInfo[playerid][PlayerVehicle3Interior] = GetPlayerInterior(playerid);
				    CreatePlayerVehicle(playerid,3);
					PutPlayerInVehicle(playerid,PlayerVehicleID3[playerid],0);
				}
				else if(PlayerVehicleID4[playerid] == vehicleid)
				{
					GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX4], PlayerInfo[playerid][PlayerVehiclePosY4], PlayerInfo[playerid][PlayerVehiclePosZ4]);
			       	GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing4]);
					DestroyVehicle(PlayerVehicleID4[playerid]);
					PlayerInfo[playerid][PlayerVehicle4VirWorld] = GetPlayerVirtualWorld(playerid);
            		PlayerInfo[playerid][PlayerVehicle4Interior] = GetPlayerInterior(playerid);
					CreatePlayerVehicle(playerid,4);
					PutPlayerInVehicle(playerid,PlayerVehicleID4[playerid],0);
				}
				else if(PlayerVehicleID5[playerid] == vehicleid)
				{
					GetVehiclePos(vehicleid, PlayerInfo[playerid][PlayerVehiclePosX5], PlayerInfo[playerid][PlayerVehiclePosY5], PlayerInfo[playerid][PlayerVehiclePosZ5]);
			      	GetVehicleZAngle(vehicleid, PlayerInfo[playerid][PlayerVehicleFacing5]);
					DestroyVehicle(PlayerVehicleID5[playerid]);
					PlayerInfo[playerid][PlayerVehicle5VirWorld] = GetPlayerVirtualWorld(playerid);
            		PlayerInfo[playerid][PlayerVehicle5Interior] = GetPlayerInterior(playerid);
					CreatePlayerVehicle(playerid,5);
					PutPlayerInVehicle(playerid,PlayerVehicleID5[playerid],0);
				}
				else
				{
					SendClientMessage(playerid,COLOR_GREY,"	You are not in a vehicle that you own.");
				}
			}
			else
			{
				SendClientMessage(playerid,COLOR_GREY,"	You are not driving a vehicle.");
			}
		}
	    return 1;
	}