[Help] Car system
#1

The problem is when someone do /buycar, the created car take a id of a existent car, not making a new one but changing the old one, and the owner appears like "Owner: (no name here)"

Can someone help me?

Код:
	if(strcmp(cmd, "/buycar", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gPlayerLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   You need to login first ! ");
	            return 1;
	        }
			new car =  GetPlayerVehicleID(playerid);
   			new model = GetVehicleModel(idcar);
			if(IsASalesVehicle(idcar))
 			{
			    if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { }
			    else return SendClientMessage(playerid, COLOR_GREY,"* You already own Two cars!");
				if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
				{
				    if(PlayerInfo[playerid][pCarLic] == 1)
					{
    					for(new h = 1; h < sizeof(CarInfo); h++)
						{
							if(CarInfo[h][cOwned] == 0)
							{
								car = h;
								h = 9999;
							}
						}
						format(string, sizeof(string),"Vehicles/%d.ini",car)
						dini_Create(string);

						if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = car; }
						else { PlayerInfo[playerid][pPcarkey] = car; }
						CarInfo[car][cOwner] = 1;
						strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
						SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
						if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
						{
							SafeSetPlayerPos(playerid, 2020.6288,-2448.9353,13.5469);
       						CarInfo[car][cLocationx] = 2020.6288;
							CarInfo[car][cLocationy] = -2448.9353;
							CarInfo[car][cLocationz] = 13.5469;
							CarInfo[car][cAngle] = 90.0000;
							SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried in your position, you can get it there!");
							SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
							SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
							GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Las Venturas Airport!", 5000, 3);
						}
						else if(IsModelABoat(idcar))
					 	{
		  		 			new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z);
						 	SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried in your position, you can get it there!");
							SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
						}
						else
						{
							SafeSetPlayerPos(playerid,2449.9614,-2620.5871,13.4661);
							CarInfo[car][cLocationx] = 2461.6628;
							CarInfo[car][cLocationy] = -2617.1330;
							CarInfo[car][cLocationz] = 13.4630;
							CarInfo[car][cAngle] = 90.0000;
							SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried in your position, you can get it there!");
							SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
						}
						CarInfo[car][cModel] = model;
						CarInfo[car][cVirWorld] = 0;
						CarInfo[car][cPaintjob] = 999;

						CarInfo[car][cColorOne] = 1;
						CarInfo[car][cColorTwo] = 1;

						CarInfo[car][cComponent0] = 0;
						CarInfo[car][cComponent1] = 0;
						CarInfo[car][cComponent2] = 0;
						CarInfo[car][cComponent3] = 0;
						CarInfo[car][cComponent4] = 0;
						CarInfo[car][cComponent5] = 0;
						CarInfo[car][cComponent6] = 0;
						CarInfo[car][cComponent7] = 0;
						CarInfo[car][cComponent8] = 0;
						CarInfo[car][cComponent9] = 0;
						CarInfo[car][cComponent10] = 0;
						CarInfo[car][cComponent11] = 0;
						CarInfo[car][cComponent12] = 0;
						CarInfo[car][cComponent13] = 0;

						ownedcar[car] = CreateVehicle(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],90.0,1,1,30000);
						PlayerPlayMusic(playerid);
						SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
						SendClientMessage(playerid, COLOR_GRAD2, "Type /carhelp to view the vehicle manual!");
						gEngine[playerid] = 0;
						engineOn[GetPlayerVehicleID(playerid)] = false;
						OnPropUpdate(4,car);
						OnPlayerUpdateEx(playerid);
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!");
						return 1;
					}
				}
				else
				{
				    SendClientMessage(playerid, COLOR_GREY, "  You don't have enough cash with you ! ");
				    return 1;
				}
    		}
	  	}
	  	return 1;
	}
Regards,
Reply
#2

pawn Код:
CarInfo[car][cOwner] = 1;
strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
Why do you set the vehicle owner to one, where did you define sendername and why do you have a destination size of 999?
Reply
#3

It's the ravens script
Reply
#4

someone?
Reply
#5

Same happened to me when I used it.
Reply
#6

i suggest,, u stop using ravens.... i workd on it 4 mounths and i aint fixed car system.. it will still replacing cars etc...
i allready asked for tihs on thos forum but i never got right answer.
Reply
#7

I suggest you script your own vehicle system from scratch, or try to understand the current one and edit it so it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)