21.05.2014, 00:48
pawn Code:
COMMAND:takecar(playerid, params[])
{
new bool:IsAtGarage, takecarr[128];
GarageLoop(g)
{
if(PublicGarage[g][gActive] == 0) continue;
if(IsPlayerInRangeOfPoint(playerid, 2.0, PublicGarage[g][garageX],PublicGarage[g][garageY],PublicGarage[g][garageZ]))
{
new zone[50];
IsAtGarage = true;
GetZone(PublicGarage[g][garageX],PublicGarage[g][garageY],PublicGarage[g][garageZ], zone);
format(takecarr, sizeof(takecarr), "{D3D3D3}Take a vehicle from {778899}%s {D3D3D3}Garage", zone);
break;
}
}
if(!IsAtGarage) return SendClientError(playerid, "You need to be outside a public garage to use this command");
IsAtGarage = false;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new Lrg[1800], count, statusaa[20];
VehLoop(v)
{
if(Vehicle[v][vActive] == 0) continue;
if(Vehicle[v][owner][0] != 0 && !strcmp(Vehicle[v][owner], pname))
{
IsAtGarage = true;
if(Vehicle[v][InGarage] == 1) statusaa = "{B0C4DE}Stored";
else statusaa = "{ff0000}Spawned";
format(LrgStr, sizeof(LrgStr), "{778899}Vehicle: {B0C4DE}%s {ffffff}>> {778899}Status: %s\n", GetVehicleNameFromModel(Vehicle[v][model]), statusaa);
strcat(Lrg, LrgStr);
}
}
if(!count) return SendClientError(playerid, "You currently do not own any vehicles");
return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, takecarr, Lrg, "Take", "Cancel");
}
pawn Code:
stock GetVehicleNameFromModel(modelid)
return VehicleName[modelid-400];