if (strcmp(cmd, "/robveh", true) == 0)
{
if(pToolkit[playerid] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You haven't got a toolkit !");
return 1;
}
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are in a vehicle !");
return 1;
}
if(!ProxDetectorV(4, playerid, VehicleInfo[playerid][vOwned]))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near any a vehicle !");
return 1;
}
if(VehicleInfo[vehicleid][vLock] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "This vehicle is not locked !");
return 1;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(strcmp(name, VehicleInfo[vehicleid][vOwner], true) == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You can't rob your vehicle !");
return 1;
}
if(pToolkit[playerid] < VehicleInfo[vehicleid][vLock])
{
format(string, sizeof(string), "%s has failed to rob a vehicle", name);
ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
else if(pToolkit[playerid] == VehicleInfo[vehicleid][vLock])
{
format(string, sizeof(string), "%s has attemps to rob a vehicle", name);
ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetTimerEx("RobVeh", 5000, false, "d", playerid, vehicleid);
Egale[playerid] = 1;
return 1;
}
else if(pToolkit[playerid] > VehicleInfo[vehicleid][vLock])
{
format(string, sizeof(string), "%s has attemps to rob a vehicle", name);
ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
SetTimerEx("RobVeh", 5000, false, "d", playerid, vehicleid);
Egale[playerid] = 0;
return 1;
}
}
}
Originally Posted by MadeMan
Are you near this vehicle: VehicleInfo[playerid][vOwned] ?
|
if(!ProxDetectorV(4, playerid, vehicleid))
for(new v=0;v<MAX_VEHICLES;v++)
if(!ProxDetectorV(4, playerid, v))
vehicleid = 0;
for(new v=1; v < MAX_VEHICLES; v++)
{
if(ProxDetectorV(4, playerid, v))
{
vehicleid = v;
break;
}
}
if(vehicleid == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near any a vehicle !");
return 1;
}