I've made this script, the vehicle locks, but doesn't unlock. I can't see an error in this code, please can anyone fix this, if you can?
Код:
else if(strcmp(x_nr,"lock",true) == 0)
{
new keycar = PlayerInfo[playerid][pPcarkey];
if(keycar != 9999)
{
new Float:X,Float:Y,Float:Z;
GetVehiclePos(keycar,X,Y,Z);
if(IsPlayerInRangeOfPoint(playerid, 25,X,Y,Z))
{
new locked[128];
locked = strtok(cmdtext, idx);
if(CarInfo[keycar][cLock] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE," Car Unlocked!");
gCarLock[idcar] = 0;
UnLockCar(idcar);
CarInfo[keycar][cLock] = 0;
OnPropUpdate(4,keycar);
return 1;
}
else if(CarInfo[keycar][cLock] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE," Car Locked!");
gCarLock[idcar] = 1;
LockCar(idcar);
CarInfo[keycar][cLock] = 1;
OnPropUpdate(4,keycar);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY,"* You must be Near or in Your car to lock it!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "* You don't have a vehicle at slot 1");
return 1;
}
}