08.09.2011, 17:12
Code:
if(strcmp(x_nr,"sell",true) == 0) { if(IsAtDealership(playerid)) { if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { GetPlayerName(playerid, sendername, sizeof(sendername)); new ownvehkey; if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; } else { return 1; } if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0) { new carsellprice = CarInfo[ownvehkey][cValue] / 4 * 3; new Float:x,Float:y,Float:z; new Float:a; CarInfo[ownvehkey][cOwned] = 0; strmid(CarInfo[ownvehkey][cOwner], "Dealership", 0, strlen("Dealership"), 999); GivePlayerMoney(playerid,carsellprice); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); format(string, sizeof(string), "~w~You have sold your car for: ~n~~g~$%d", carsellprice); GameTextForPlayer(playerid, string, 10000, 3); GetVehiclePos(ownvehkey, x, y, z); GetVehicleZAngle(ownvehkey, a); CarInfo[ownvehkey][cLocationx] = x; CarInfo[ownvehkey][cLocationy] = y; CarInfo[ownvehkey][cLocationz] = z; CarInfo[ownvehkey][cAngle] = a; CarInfo[ownvehkey][mod1] = 0; CarInfo[ownvehkey][mod2] = 0; CarInfo[ownvehkey][mod3] = 0; CarInfo[ownvehkey][mod4] = 0; CarInfo[ownvehkey][mod5] = 0; CarInfo[ownvehkey][mod6] = 0; CarInfo[ownvehkey][mod7] = 0; CarInfo[ownvehkey][mod8] = 0; CarInfo[ownvehkey][mod9] = 0; CarInfo[ownvehkey][mod10] = 0; CarInfo[ownvehkey][mod11] = 0; CarInfo[ownvehkey][mod12] = 0; CarInfo[ownvehkey][mod13] = 0; CarInfo[ownvehkey][mod14] = 0; CarInfo[ownvehkey][mod15] = 0; CarInfo[ownvehkey][mod16] = 0; CarInfo[ownvehkey][mod17] = 0; CarInfo[ownvehkey][paintjob] = -1; if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { PlayerInfo[playerid][pPcarkey] = -1; } RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 1); format(CarInfo[vehid][cLicense], 32 ,"ForSale"); SetVehicleNumberPlate(vehid,CarInfo[vehid][cLicense]); OnPropUpdate(); OnPlayerUpdateEx(playerid); DestroyVehicle(ownvehkey); new thiscar = CreateVehicle(CarInfo[ownvehkey][cModel],CarInfo[ownvehkey][cLocationx],CarInfo[ownvehkey][cLocationy],CarInfo[ownvehkey][cLocationz]+1.0,CarInfo[ownvehkey][cAngle],CarInfo[ownvehkey][cColorOne],CarInfo[ownvehkey][cColorTwo],60000); LoadComponents(thiscar); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it! "); return 1; } } else { SendClientMessage(playerid, COLOR_GREY, "You are not at a dealership"); return 1; } }
this is the code, how can i make, when i type /v sell to spawn the vehicle in a parking ? ( random ) but if is a car there, spawn at other place...