Locked car bug
#1

Well, if the player parks his car while its locked, and relogs he won't be able to unlock/lock it again somehow, except if he gets into it, of course it's impossible since its locked.

here's the command:

Код:
    if(strcmp(cmd, "/lock", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
			new oldcar = gLastCar[playerid];
			new Float:cx, Float:cy, Float:cz;
			GetVehiclePos(oldcar, cx, cy, cz);
   			if(IsPlayerInRangeOfPoint(playerid, 4, cx, cy, cz))
   			{
   			    if(gVehicleLock[playerid] != 1)
				{
                	SendClientMessage(playerid, COLOR_GREY, "   You don't have a lock for this vehicle !");
					return 1;
				}
   			    if(IsABike(oldcar) || IsABoat(oldcar) || IsAPlane(oldcar) || IsAHelicopter(oldcar) || IsATrain(oldcar))
				{
			    	SendClientMessage(playerid, COLOR_GREY, "   You can't lock that type of vehicle !");
					return 1;
				}
   			    GetPlayerName(playerid, sendername, sizeof(sendername));
				if(gCarLock[oldcar] == 1)
				{
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
			    	if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has unlocked their vehicle.");
					else format(string, sizeof(string), "* %s has unlocked their vehicle.", sendername);
			    	ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			    	UnLockCar(oldcar);
				}
				else
				{
					if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has locked their vehicle.");
					else format(string, sizeof(string), "* %s has locked their vehicle.", sendername);
			    	ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
			    	LockCar(oldcar);
				}
   			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are too far away from your vehicle!");
				return 1;
			}
        }
        return 1;
    }
Reply
#2

any help will be appreciated it.
Reply
#3

Use the OnVehicleStreamIn function to check if the vehicle is locked using the integer "gCarLock[oldcar]". If it is, lock it.
Reply
#4

Quote:

public OnVehicleStreamIn(vehicleid, forplayerid)
{

if(gCarLock[vehicleid] == 1) LockCar(vehicleid);
else UnLockCar(vehicleid);
return 1;
}

Still doesn't work
Reply
#5

pawn Код:
public OnVehicleStreamIn(vehicle, forplayerid)
{
if(gCarLock[vehicleid]) SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
else SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 0);
return true;
}
Reply
#6

doesn't work
Reply
#7

I hope that someone is able to help me!.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)