Clear vehicle previously created
#1

This system is for Vehicle spawn
However has no limit vehicles created, the player has to create more than 100 vehicles and would like to fill the server cars
I wonder if someone can edit to create when a car deletasse the last car designed by him

PHP код:
if(!strcmp(cmdtext"/veh"true))
{
if(
Logado[playerid] < 1) return SendClientMessage(playerid,COLOR_RED,"Erro: Vocк tem que estar logado para usar este comando.");
SendClientMessage(playeridCOR_PRINCIPAL"Mantenha o servidor limpo!");
ShowPlayerDialog(playeridCarrosDIALOG_STYLE_LIST"Carros""Sultan \nTurismo \nФnibus 1 \nBMX \nTanke de guerra \nHydra \nFaggio \nSanchez \nHйlicoptero do Exйrcito \nAviгo \nMonster \nVortex \nNRG-500""Criar""Cancelar");
return 
1;
}
if(
dialogid == Carros)
{
if(
response)
{
new 
Float:X,Float:Y,Float:Z,Float:Angle;
if(
listitem == 0)  // Sultan
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(560X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 1)   // Turismo
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(451X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 2)   // Фnibus 1
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(437X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 3)   // BMX
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(481X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 4)   // Tanke de guerra
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(432X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 5)   // Hydra
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(520X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 6)   // FAGGIO
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(462X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 7)   //S ANCHEZ
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(468X+5YZ+1Anglerandom(100), random(100), -1);
SendClientMessage(playeridCOR_PRINCIPAL"Vocк criou um veнculo, lembre-se de deleta-lo (/dc)!");
SendClientMessage(playeridCOR_PRINCIPAL"Mantenha o servidor limpo!");
}
if(
listitem == 8)   // Hйlicoptero do Exйrcito
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(425X+5YZ+1Anglerandom(100), random(100), -1);
SendClientMessage(playeridCOR_PRINCIPAL"Vocк criou um veнculo, lembre-se de deleta-lo (/dc)!");
SendClientMessage(playeridCOR_PRINCIPAL"Mantenha o servidor limpo!");
}
if(
listitem == 9)   // Aviгo
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(551X+5YZ+1Anglerandom(100), random(100), -1);
SendClientMessage(playeridCOR_PRINCIPAL"Vocк criou um veнculo, lembre-se de deleta-lo (/dc)!");
SendClientMessage(playeridCOR_PRINCIPAL"Mantenha o servidor limpo!");
}
if(
listitem == 10)   // MONSTER
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(556X+5YZ+1Anglerandom(100), random(100), -1);
SendClientMessage(playeridCOR_PRINCIPAL"Vocк criou um veнculo, lembre-se de deleta-lo (/dc)!");
SendClientMessage(playeridCOR_PRINCIPAL"Mantenha o servidor limpo!");
}
if(
listitem == 11)   // VORTEX .-.
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(539X+5YZ+1Anglerandom(100), random(100), -1);
}
if(
listitem == 12)   // NRG-500
{
GetPlayerPos(playeridXYZ);
GetPlayerFacingAngle(playeridAngle);
CreateVehicle(522X+5YZ+1Anglerandom(100), random(100), -1);
}
}
return 
1;

Sorry for my English, I used ****** translator
Reply
#2

pawn Код:
//top of script
#define MAX_CARS 10 //Set to max cars you want for each player
new CarNum[MAX_PLAYERS] = 0;
new CarCount[MAX_PLAYERS][CarNum[playerid]];


//Anytime you spawn a vehicle, add these lines:
if (CarNum[playerid] >= MAX_CARS) return SendClientMessage(playerid,0xFFFFFFFF,"You have too many cars! Use /delcars to remove your cars!");
CarCount[playerid][CarNum[playerid]] = CreateVehicle...
CarNum[playerid]++;

// delete cars
CMD:delcars(playerid,params[])
{
for (new i=0;i<MAX_CARS;i++)
{
DestroyVehicle(CarCount[playerid][i]);
}
CarNum[playerid] = 0;
return 1;
}
If that doesn't work, I apologize ahead of time.
Reply
#3

build error
http://i.imgur.com/FnTAlC7.jpg
Reply
#4

pawn Код:
// Change this
new CarCount[MAX_PLAYERS][CarNum[playerid]];

// to this
new CarCount[MAX_PLAYERS][CarNum[MAX_PLAYERS]];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)