17.08.2015, 16:31
I guess this is what you're looking for. I've explained my code in comments, tell me if you need further explanation though!
pawn Код:
if(strcmp(cmd, "/descuiemasina", true) == 0)
{
if(PlayerData[playerid][pMember] == 10 || PlayerData[playerid][pLeader] == 10)
{
if(PlayerData[playerid][pRank] >= 5)
{
new Float:distance = 12.0; // The maximum range which we check vehicles around
new Float:X, Y, Z;
GetPlayerPos(playerid, X, Y, Z);
new engine,lights,alarm,doors,bonnet,boot,objective;
for(new i = 0; i < MAX_VEHICLES; i ++) // Loop through all vehicles
{
// Ignore invalid vehicles
if(GetVehicleModel(i) == 0)
continue;
// If this vehicle is actually locked
if(VehLocked[i] == 1)
{
// This vehicle is locked. Now let's check if it's in the range of this player.
if(GetVehicleDistanceFromPoint(i, X, Y, Z) <= distance)
{
VehLocked[i] = 0;
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(i,engine,lights,alarm,0,bonnet,boot,objective);
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Nu ai rank 5+!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Nu esti membru remorcari auto!");
}
return 1;
}