Posts: 453
Threads: 173
Joined: Jun 2011
Reputation:
0
Hi people.I need some help.I have All save and load scripts,but i don't know how to save player car by vehicle id?I want to do that when player disconnect.
Posts: 453
Threads: 173
Joined: Jun 2011
Reputation:
0
How i can use that?I talk about OnPlayerDisconnect,how can i get player vehicle id if player out?
PlayerData[playerid][pcar] with this i check is player have he own car,ten i try check:
new vehicleid = GetPlayerVehicleID(PlayerData[playerid][pcar]); i try to get vehicle id he own car,but don't work...
Posts: 102
Threads: 7
Joined: Nov 2010
Reputation:
0
Past your code on how to save your vehicle.
Posts: 453
Threads: 173
Joined: Jun 2011
Reputation:
0
stock SaveCar(playerid,vehicleid)
{
if(PlayerData[ playerid ][ pcar ] == -1) return;//if player don't have he own car for him don't save car.
print("Car successfully save");
new files[ 128 ];
format( files, 60, "saves/cars/%d.ini",vehicleid);
if(!fexist(files)){dini_Create(files);}
Posts: 102
Threads: 7
Joined: Nov 2010
Reputation:
0
When you buy a car, how do you create the vehicle?
Can I see that part of the code?
Posts: 453
Threads: 173
Joined: Jun 2011
Reputation:
0
new iRandom = random(sizeof(TurgausSpawn));
new TempVeh = CreateVehicle(534,TurgausSpawn[iRandom][0], TurgausSpawn[iRandom][1], TurgausSpawn[iRandom][2], TurgausSpawn[iRandom][3], -1, -1, -1);
PlayerData[playerid][pcar]=TempVeh;
vehicleDB[TempVeh][Lock]=true;
vehicleDB[vehicleid][sell]=true;
vehicleDB[TempVeh][gas]=40;
GetPlayerName(playerid,vehicleDB[TempVeh][owner_name],MAX_PLAYER_NAME);
SendClientMessage(playerid, COLOR_GREEN, " Your car succefull have made.You can found it: /carmapp");
SendClientMessage(playerid, COLOR_RED, " Don't forget lock your car!");
GivePlayerMoneyA(playerid, -9000);
SetVehicleToRespawn(vehicleid);
Posts: 7,801
Threads: 187
Joined: Feb 2010
Reputation:
0
Keep in mind, vehicle ID's will never be the same. You can save vehicle ID 3, remove vehicle ID 3, spawn another vehicle- which would take ID 3, then spawn the saved vehicle, it will end up screwing up the server. It would be better to write your own type of vehicle ID system.
Posts: 453
Threads: 173
Joined: Jun 2011
Reputation:
0
Thanks i try,please reply to me another thread "anti-car stealing"