Vehicle still locked. - 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 still locked. (
/showthread.php?tid=657847)
Vehicle still locked. -
AzaMx - 16.08.2018
Hi, I got a problem with this system, still locked even tho I already set it to unlocked when car respawned.
PHP Code:
if(strcmp(Vehicles[vehicleid][carowner],"NoBodY", false, 6) || Vehicles[vehicleid][carteam] != NO_TEAM_CAR)
{
UnlockVehicle(Vehicles[vehicleid][vrID]);
}
else
{
LockVehicle(-1,Vehicles[vehicleid][vrID]);
}
Re: Vehicle still locked. -
Shockey HD - 16.08.2018
Show us your LockVehicle function?
Re: Vehicle still locked. -
AzaMx - 16.08.2018
PHP Code:
stock LockVehicle(playerid, vehicleid)
{
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && i != playerid) SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
Vehicles[FindVehicleID(vehicleid)][tmplocked] = 1;
Vehicles[FindVehicleID(vehicleid)][tmplockedby] = playerid;
}
stock UnlockVehicle(vehicleid)
{
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(vehicleid, i, 0, 0);
Vehicles[FindVehicleID(vehicleid)][tmplocked] = 0;
Vehicles[FindVehicleID(vehicleid)][tmplockedby] = -1;
}