public OnEmptyVehicleDamage(vehicleid,playerid,exems)
{
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
//==============================================================================
//Vehicle Unlock system
//==============================================================================
if(IsPlayerLookingAtVehicle(playerid,vehicleid))
{
if(gTeam[playerid] == TEAM_BANDIT)
{
if(unlocked[vehicleid] != 0)
{
GameTextForPlayer(playerid,"~y~This vehicle is already unlocked!",4000,3);
return 1;
}
new vehicle;
vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
//////////
//Nebula//
//////////
if(unlocked[vehicleid] == 0)
{
if(vehicle == 516)
{
if(doors <100)
{
new crand = random(100);
if(crand <= 10)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 10)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
//////////////
//Washington//
//////////////
else if(vehicle == 421)
{
if(doors <100)
{
new crand = random(100);
if(crand <= 30)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 30)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
///////////
//stretch//
///////////
else if(vehicle == 409)
{
if(doors <100)
{
new crand = random(100);
if(crand <= 60)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 60)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
//======================================================
//Cops
//======================================================
////////
//Lspd//
////////
else if(vehicle == 596 || vehicle == 599)
{
if(doors <100)
{
new crand = random(100);
if(crand <= 75)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of good this secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 75)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
///////////
//S.W.A.T//
///////////
else if(vehicle == 601)
{
if(doors <100)
{
new crand = random(100);
if(crand <= 90)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this heavy secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 90)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
///////
//FBI//
///////
else if(vehicle == 490)
{
if(doors <100)
{
new crand = random(100);
if(crand <= 95)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this heavy secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 95)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
}
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(unlocked[vehicleid] == 0)
{
if(gTeam[playerid] == TEAM_BANDIT)
{
SendClientMessage(playerid, COLOR_RED, "This vehicle is locked for you! Shoot its door to open the vehicle");
TogglePlayerControllable(playerid,0);
TogglePlayerControllable(playerid,1);
return 1;
}
}
if(funlocked[vehicleid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You have failed braking the lock of this vehicle, try another car!");
TogglePlayerControllable(playerid,0);
TogglePlayerControllable(playerid,1);
return 1;
}
return 1;
}
SendClientMessage(playerid, COLOR_RED, "This vehicle is locked for you! Shoot its door to open the vehicle");
SendClientMessage(playerid, COLOR_RED, "You have failed braking the lock of this vehicle, try another car!");
but since I added more cars I don't get the message no more, and the vehicle does not get unlocked :/ |
if(funlocked[vehicleid] == 1) |
switch(vehicleid)
{
case 516:
{
//Do your stealable vehicle thinghy
}
case 490:
{
//Do your stealable vehicle thinghy
}
default:
{
//If the car isn't stealable
}
}
new panels,doors,lights,tires;
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
//==============================================================================
//Car stealing system
//==============================================================================
if(IsPlayerLookingAtVehicle(playerid,vehicleid))
{
if(gTeam[playerid] == TEAM_BANDIT)
{
if(unlocked[vehicleid] == 1)
{
GameTextForPlayer(playerid,"~y~This vehicle is already unlocked!",4000,3);
return 1;
}
if(unlocked[vehicleid] == 0)
{
switch(vehicleid)
{
//////////
//Nebula//
//////////
case 516:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 10)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 10)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
//////////////
//Washington//
//////////////
case 421:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 30)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 30)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
///////////
//Stretch//
///////////
case 409:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 60)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 60)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
//======================================================
//Cops
//======================================================
////////
//Lspd//
////////
case 596:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 75)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this good secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 75)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
////////
//Lspd//
////////
case 599:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 75)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this good secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 75)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
///////////
//S.W.A.T//
///////////
case 601:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 90)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this heavy secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 90)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
///////
//FBI//
///////
case 490:
{
if(doors <100)
{
new crand = random(100);
if(crand <= 95)
{
GameTextForPlayer(playerid,"~r~U have failed shooting the lock of this heavy secured door, try another car...",4000,3);
funlocked[vehicleid] = 1;
SetTimer("lockshotrectim", 30000, false);
unlocked[vehicleid] = 0;
}
else if(crand > 95)
{
unlocked[vehicleid] = 1;
GameTextForPlayer(playerid,"~y~U have unlocked this Vehicle by shooting its door!",4000,3);
}
}
}
default:
{
SendClientMessage(playerid, COLOR_RED, "This car is not stealable!");
}
}
}
}
}
switch(GetVehicleModel(vehicleid))