31.12.2013, 20:51
Hi all
I not good at loops so i need help with that problem:
when i use the command /destroycars to the destroy the vehicle i created by command /veh the SendClientMessage is doubling (of course because of the wrong loop)
after /destroycars also i cant spawn anymore vehicles through /veh
thanks in advance

/destroycars command
/veh command
I not good at loops so i need help with that problem:
when i use the command /destroycars to the destroy the vehicle i created by command /veh the SendClientMessage is doubling (of course because of the wrong loop)
after /destroycars also i cant spawn anymore vehicles through /veh
thanks in advance

/destroycars command
Код:
CMD:destroycars(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) {
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}
for(new i = 0; i < sizeof(cVeh); i++) {
if(cVeh[i] != INVALID_VEHICLE_ID) {
DestroyVehicle(cVeh[i]);
cVeh[i] = INVALID_VEHICLE_ID;
new string[128];
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has destroyed all Created vehicles (/veh)icle.", NORPN(playerid));
SendAdminMessage(COLOR_DARKRED, 1, string);
}
}
SendClientMessage(playerid, COLOR_GREY, " Created vehicles destroyed!");
return 1;
}
Код:
CMD:veh(playerid, params[])
{
new id, Float:pos[4], col[2], stringlog[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
// if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "iii", id, col[0], col[1])) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
if(id < 400 || id > 611) return SendClientMessage(playerid, COLOR_GREY, "Vehicles are between 400 and 611.");
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
for(new i=0; i<MAX_CUSTOM_VEHICLES; i++)
{
if(!cVeh[i])
{
cVeh[i] = CreateVehicle(id, pos[0], pos[1], pos[2], pos[3], col[0], col[1], 12000);
LinkVehicleToInterior(cVeh[i], GetPlayerInterior(playerid));
i = MAX_CUSTOM_VEHICLES;
}
}
new string[128];
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has spawned a (/veh)icle model %d.", NORPN(playerid), id);
SendAdminMessage(COLOR_DARKRED, 1, string);
// veh Log
Log("logs/veh.log", stringlog);
return 1;
}

