Vehicle Park *Save*
#1

Hello guys.

I'm attempting to figure out how to make the /park command in my sarp based script save colors. Tuning is for right now not very important, but the goal is to make this command:

Код:
if(strcmp(cmd, "/park", true) == 0)
	{
		if(IsPlayerConnected(playerid))
	    {
	    	new playercar1 = PlayerInfo[playerid][CarLinkID];
	    	new playercar2 = PlayerInfo[playerid][Car2LinkID];
     		if(PlayerInfo[playerid][CarLinkID] == 0 && PlayerInfo[playerid][Car2LinkID] == 0)
			{
				SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
				return 1;
			}
			if(!IsPlayerInVehicle(playerid, playercar1) && !IsPlayerInVehicle(playerid, playercar2))
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not inside your vehicle!");
				return 1;
			}
   			if(PlayerInfo[playerid][PlayerCarModel] < 0 || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][CarLinkID])
    		{
  				new Float: tmpdamage;
       			GetVehicleHealth(PlayerInfo[playerid][CarLinkID], tmpdamage);
	    		GetVehicleZAngle(PlayerInfo[playerid][CarLinkID], PlayerInfo[playerid][CarZAngle]);
		    	GetVehiclePos(PlayerInfo[playerid][CarLinkID], PlayerInfo[playerid][CarX], PlayerInfo[playerid][CarY], PlayerInfo[playerid][CarZ]);
				DestroyVehicle(PlayerInfo[playerid][CarLinkID]);
				OwnedCarCount--;
				CarCount--;
				SpawnOwnedCar(playerid, 1);
   				PutPlayerInVehicle(playerid, PlayerInfo[playerid][CarLinkID], 0);
		    	SetVehicleHealth(PlayerInfo[playerid][CarLinkID], tmpdamage);
		    	GetPlayerName(playerid, sendername, sizeof(sendername));
		    	format(string, sizeof(string), "* %s has parked his vehicle.", sendername);
		    	ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
  			else if(PlayerInfo[playerid][PlayerCarModel2] < 0 || GetPlayerVehicleID( playerid ) == PlayerInfo[playerid][Car2LinkID])
    		{
    			new Float: tmpdamage;
      			GetVehicleHealth( PlayerInfo[playerid][Car2LinkID], tmpdamage );
	    		GetVehicleZAngle( PlayerInfo[playerid][Car2LinkID], PlayerInfo[playerid][Car2ZAngle] );
	    		GetVehiclePos( PlayerInfo[playerid][Car2LinkID], PlayerInfo[playerid][Car2X], PlayerInfo[playerid][Car2Y], PlayerInfo[playerid][Car2Z] );
				DestroyVehicle( PlayerInfo[playerid][Car2LinkID] );
				OwnedCarCount--;
				CarCount--;
  				SpawnOwnedCar( playerid, 2 );
    			PutPlayerInVehicle( playerid, PlayerInfo[playerid][Car2LinkID], 0 );
	    		SetVehicleHealth( PlayerInfo[playerid][Car2LinkID], tmpdamage );
        		GetPlayerName(playerid, sendername, sizeof(sendername));
		    	format(string, sizeof(string), "* %s has parked his vehicle.", sendername);
		    	ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	    	}
    	}
	    return 1;
	}
Capable of detecting the car colors as it gets parked, and apply the colors to the userfile, which uses the following:
Код:
PlayerInfo[playerid][CarCol1] = 0;
PlayerInfo[playerid][CarCol2] = 0;
Reply
#2

I'd recommend this for getting the vehicles colors:
https://sampforum.blast.hk/showthread.php?tid=235398
Reply
#3

Hey guys.

I have been attempting to work around with it, but I can't seem to make it work properly. I'm not that familiar with storage systems, how can I make it save the colors in
CarCol1,
CarCol2,
Car2Col1,
Car2Col2,

As I can see this saves the spawn of the car:

Код:
GetVehicleZAngle(PlayerInfo[playerid][CarLinkID], PlayerInfo[playerid][CarZAngle]);
		    	GetVehiclePos(PlayerInfo[playerid][CarLinkID], PlayerInfo[playerid][CarX], PlayerInfo[playerid][CarY], PlayerInfo[playerid][CarZ]);
How would I make use of GetVehicleColor and then store it into the "CarCol1" and so on?
Reply
#4

Bump
Reply
#5

I'm not exactly sure if I sure use GetVehicleColor on /park to save it, but with that being said, I can't in any way get it to store the color values inside the CarCol1, CarCol2 (and if car 2) Car2Col1, Car2Col2.
Reply
#6

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)