CMD:respawn(playerid, params[])
{
if(APlayerData[playerid][PlayerLevel] >= 4)
{
new str[128], bool:vehicle[MAX_VEHICLES], AdminName[24];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(str, sizeof(str), "» {999999}Administrador {FFFFFF}%s {00FF00}respawnou {999999}todos os veiculos desoucupados!", AdminName);
SendClientMessage(playerid, -1, str);
for(new j = 1; GetVehicleModel(j); ++j)
{
vehicle[j] = false;
for(new i, p = GetMaxPlayers(); i < p; ++i)
{
if(!IsPlayerInAnyVehicle(i) || !IsPlayerConnected(i) )
continue;
if(IsPlayerInVehicle(i, j))
{
vehicle[j] = true;
break;
}
}
if(!vehicle[j])
if(!IsTrailerAttachedToVehicle(j))
SetVehicleToRespawn(j);
}
}
else
SendClientMessage(playerid, -1, "» {FF0000}Vocк nгo tem permissгo para usar este comando!");
return true;
}
CMD:respawn(playerid, params[])
{
SendAdminText(playerid, "/respawn", params);
if(APlayerData[playerid][PlayerLevel] >= 4)
{
new str[128], AdminName[24];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(str, sizeof(str), "{a9c4e4}Administrador {FFFFFF}%s {a9c4e4}respawnou todos os veiculos desoucupados!", AdminName);
SendClientMessageToAll(-1, str);
for(new i; i < MAX_VEHICLES; i++)
if(!IsVehicleInUse(i))
SetVehicleToRespawn(i);
}
else
SendClientMessage(playerid, -1, "{ff0000}Vocк nгo tem permissгo para usar este comando!");
return true;
}
pawn Код:
|
COMMAND:respawncarros(playerid, params[])
{
SendAdminText(playerid, "/respawncarros", params);
if (APlayerData[playerid][PlayerLevel] < 3) return 0;
ResetarVeiculos();
new Msg[126], Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
format(Msg, 126, "{FFFFFF}O Adminstrador {FFFFFF}%s {FFFFFF}resetou todos os veiculos desocupados.",Name);
SendClientMessageToAll(0xFF99AADD, Msg);
return true;
}
stock ResetarVeiculos()
{
static bool:TrailerEmUso[MAX_VEHICLES];
new Ciclo = 1;
for(new x = 1; x <= MAX_VEHICLES; x++)
{
switch(Ciclo)
{
case 1:
{
if(IsTrailerAttachedToVehicle(x))
{
TrailerEmUso[GetVehicleTrailer(x) - 1] = true;
}
}
case 2:
{
new bool:Ocupado;
for(new y = 0, z = GetMaxPlayers(); y != z; y++)
{
if(IsPlayerInVehicle(y, x))
{
Ocupado = true;
}
}
if(!Ocupado && !TrailerEmUso[x - 1])
{
SetVehicleToRespawn(x);
}
}
case 3:
{
TrailerEmUso[x - 1] = false;
}
}
if(x == MAX_VEHICLES && Ciclo < 3)
{
x = 0;
Ciclo++;
}
}
return true;
}