Vehicle problem - 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: Vehicle problem (
/showthread.php?tid=395700)
Vehicle problem -
Moron - 27.11.2012
Vehicles that are spawned through vehicleDB.txt file work fine, but when I destroy a locked vehicle that I spawn with a vehicle spawn command in-game the playerDB[user][pcar]=-1; doesn't work and it is shows that I still have a car.
Код:
if(vehicleDB[vehicleid][locked]) // If the car is locked
{
new name[MAX_PLAYER_NAME];
new user = vehicleDB[vehicleid][lastuser];
GetPlayerName(user,name,sizeof(name));
if(!IsPlayerConnected(user)) return 1;
if(strcmp(name,vehicleDB[vehicleid][owner_name],true)) return 1;
playerDB[user][pcar]=-1; // Sets that player no longer has a car
return 1;
}
Код:
new vehicleid = CreateVehicle(model, x, y, z, rotation, color, color, respawntime);
playerDB[playerid][pcar]=vehicleid;
vehicleDB[vehicleid][locked]=true;