I think i do it on a other way...
Vehicles 5 ++ = Error: You have reached the spawn limit. please use: /cleanup.
pawn Код:
#include <a_samp>
new IsSpawnedVehicle[MAX_PLAYERS];
#define COLOR_ERROR 0xFF303EAA
#define DIALOGID 1
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/vehicles", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Vehicle Categories", "Airplanes\nHelicopters\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service Vehicles\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nUnique Vehicles\nRC Vehicles", "Select", "Cancel");
return 1;
}
else if (strcmp("/aclenup", cmdtext, true, 10) == 0) //Fail
{
if(IsPlayerAdmin(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
DestroyVehicle(IsSpawnedVehicle[i]);
SendClientMessage(playerid, 0xFF0000FF, "Info => All vehicles cleaned up!");
return 1;
}
}
return 0;
}
else if (strcmp("/cleanup", cmdtext, true, 10) == 0) //Fail
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
DestroyVehicle(IsSpawnedVehicle[i]);
SendClientMessage(i, 0xFF0000FF, "Info => You cleaned up the vehicles YOU used/uses");
IsSpawnedVehicle[i] = 0;
return 1;
}
return 0;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOGID) // Vehicle Dialog
{
if(!response) return SendClientMessage(playerid, COLOR_ERROR,"Error: You have cancelled.");
{
if(listitem == 0) // Airplanes
{
ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Airplanes", "Andromada \nAT-400 \nBeagle \nBack", "Select", "Cancel");
return 1;
}
}
}
else if(dialogid == DIALOGID+1) // Airplanes
{
if(!response) return SendClientMessage(playerid, COLOR_ERROR,"Error: You have cancelled.");
{
if(listitem == 0) // Andromada
{
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
new vehicleid = CreateVehicle(592, X,Y,Z,A, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
IsSpawnedVehicle[playerid] = 1;
return 1;
}
else if(listitem == 1) //AT-400
{
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
new vehicleid = CreateVehicle(577, X,Y,Z,A, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
IsSpawnedVehicle[playerid] = 1;
return 1;
}
else if(listitem == 2) // Beagle
{
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
new vehicleid = CreateVehicle(511, X,Y,Z,A, -1, -1, -1);
PutPlayerInVehicle(playerid, vehicleid, 0);
IsSpawnedVehicle[playerid] = 1;
return 1;
}
else if(listitem == 3) // Back
{
ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Vehicle Categories", "Airplanes", "Select", "Cancel");
return 1;
}
}
}
return 0;
}