20.01.2010, 12:32
I have bug on this code:
When I lock my car and then going into interrior and then get out my car is unlocked please help me
PHP код:
else if(!strcmp(x_v, "lock",true))
{
if(ProxDetectorV(10, playerid, veh1[playerid]))
{
//if(VehicleInfo[veh1[playerid]][vLockBuyed] == 0)
// return SendClientMessage(playerid, COLOR_WHITE," Your vehicle doesn`t have lock use /v buylock");
if(VehicleInfo[veh1[playerid]][vLock])
{
VehicleInfo[veh1[playerid]][vLock] = 0;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh1[playerid]] = 0;
UnLockCar(veh1[playerid]);
SaveVehicles(playerid, veh1[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~g~Unlocked", VehicleNames[GetVehicleModel(veh1[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
format(string, sizeof(string), "* %s unlocks his %s.", sendername ,VehicleNames[GetVehicleModel(veh1[playerid])-400]);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
else
{
VehicleInfo[veh1[playerid]][vLock] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh1[playerid]] = 1;
LockCar(veh1[playerid]);
SaveVehicles(playerid, veh1[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~r~Locked", VehicleNames[GetVehicleModel(veh1[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
format(string, sizeof(string), "* %s locks his %s.", sendername ,VehicleNames[GetVehicleModel(veh1[playerid])-400]);
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
}
else if(ProxDetectorV(10, playerid, veh2[playerid]))
{
//if(VehicleInfo[veh2[playerid]][vLockBuyed] == 0)
// return SendClientMessage(playerid, COLOR_WHITE," Your vehicle doesn`t have lock use /v buylock");
if(VehicleInfo[veh2[playerid]][vLock])
{
VehicleInfo[veh2[playerid]][vLock] = 0;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh2[playerid]] = 0;
UnLockCar(veh2[playerid]);
SaveVehicles(playerid, veh2[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~g~Unlocked", VehicleNames[GetVehicleModel(veh2[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
else
{
VehicleInfo[veh2[playerid]][vLock] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh2[playerid]] = 1;
LockCar(veh2[playerid]);
SaveVehicles(playerid, veh2[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~r~Locked", VehicleNames[GetVehicleModel(veh2[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
}
else if(ProxDetectorV(10, playerid, veh3[playerid]))
{
//if(VehicleInfo[veh3[playerid]][vLockBuyed] == 0)
// return SendClientMessage(playerid, COLOR_WHITE," Your vehicle doesn`t have lock use /v buylock");
if(VehicleInfo[veh3[playerid]][vLock])
{
VehicleInfo[veh3[playerid]][vLock] = 0;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh3[playerid]] = 0;
UnLockCar(veh3[playerid]);
SaveVehicles(playerid, veh3[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~g~Unlocked", VehicleNames[GetVehicleModel(veh3[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
else
{
VehicleInfo[veh3[playerid]][vLock] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh3[playerid]] = 1;
LockCar(veh3[playerid]);
SaveVehicles(playerid, veh3[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~r~Locked", VehicleNames[GetVehicleModel(veh3[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
}
else if(ProxDetectorV(10, playerid, veh4[playerid]))
{
//if(VehicleInfo[veh4[playerid]][vLockBuyed] == 0)
// return SendClientMessage(playerid, COLOR_WHITE," Your vehicle doesn`t have lock use /v buylock");
if(VehicleInfo[veh4[playerid]][vLock])
{
VehicleInfo[veh4[playerid]][vLock] = 0;
gCarLock[veh4[playerid]] = 0;
UnLockCar(veh4[playerid]);
SaveVehicles(playerid, veh4[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~g~Unlocked", VehicleNames[GetVehicleModel(veh4[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
else
{
VehicleInfo[veh4[playerid]][vLock] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh4[playerid]] = 1;
LockCar(veh4[playerid]);
SaveVehicles(playerid, veh4[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~r~Locked", VehicleNames[GetVehicleModel(veh4[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
}
else if(ProxDetectorV(10, playerid, veh5[playerid]))
{
//if(VehicleInfo[veh5[playerid]][vLockBuyed] == 0)
// return SendClientMessage(playerid, COLOR_WHITE," Your vehicle doesn`t have lock use /v buylock");
if(VehicleInfo[veh5[playerid]][vLock])
{
VehicleInfo[veh5[playerid]][vLock] = 0;
gCarLock[veh5[playerid]] = 0;
UnLockCar(veh5[playerid]);
SaveVehicles(playerid, veh5[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~g~Unlocked", VehicleNames[GetVehicleModel(veh5[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
else
{
VehicleInfo[veh5[playerid]][vLock] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[veh5[playerid]] = 1;
LockCar(veh5[playerid]);
SaveVehicles(playerid, veh5[playerid]);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~r~Locked", VehicleNames[GetVehicleModel(veh5[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
}
else
{
if(PlayerInfo[playerid][pPcarkey] != 999 || PlayerInfo[playerid][pPcarkey2] != 999 || PlayerInfo[playerid][pPcarkey3] != 999)
{
for(new iv = 0; iv < MAX_VEHICLES; iv++)
{
if(ProxDetectorV(10, playerid, iv))
{
if(VehicleInfo[iv][vOwned] == 1)
{
if(!strcmp(PlayerInfo[playerid][pPcarkey], VehicleInfo[iv][vKey], true) || !strcmp(PlayerInfo[playerid][pPcarkey2], VehicleInfo[iv][vKey], true)
||!strcmp(PlayerInfo[playerid][pPcarkey3], VehicleInfo[iv][vKey], true))
{
VehicleInfo[iv][vLock] = 1;
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
gCarLock[iv] = 1;
LockCar(iv);
SaveVehicles(playerid, iv);
new str[256];
format(str, sizeof(str), "~y~%s ~n~~r~Locked", VehicleNames[GetVehicleModel(veh5[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 5);
return 1;
}
}
}
}
}
return 1;
}
}