29.05.2012, 21:17
mais que apenas admins possam usar esse comando ajudem pfv
if(strcmp(cmdtext, "/rc",true)==0)
{
if(!IsPlayerAdmin(playerid)) return false;
for(new cars=0; cars<MAX_VEHICLES; cars++)
{
if(!VehicleOccupied(cars))
{
SetVehicleToRespawn(cars);
}
}
return 1;
}
forward VehicleOccupied(vehicleid);
public VehicleOccupied(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
//na public OnPlayerComandText
if(strcmp("/Respawn", cmdtext, true, 10) == 0){if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Vocк nгo estб logado na RCON.");ResetarCarros();return 1;}
//no fim do GM
stock ResetarCarros(){static bool:inVeh;for(new i; i < MAX_VEHICLES; i++ ){inVeh = false;for(new j; j < GetMaxPlayers(); j++ ){if(IsPlayerInVehicle( j, i ))inVeh = true;break;}if(!inVeh) SetVehicleToRespawn(i);}}
COMMAND:rcars(playerid, params[])
{
GetPlayerName(playerid, Name, sizeof(Name));
format(don, sizeof(don), "{FF0000}[Admin]{FFFFFF}Veiculos serar resetados em 10 segundos pelo admin {FF0000}%s{FFFFFF}.",Name);
SendClientMessageToAll(-1,don);
SetTimer("Respawn",10000,true);
return 1;
}
forward Respawn();
public Respawn()
{
for(new j = 1; j < GetVehicleModel(j); j++)
{
vehicle[j] = false;
for(new i, p = MAX_PLAYERS; i < p; i++)
{
if(!IsPlayerInAnyVehicle(i) || !IsPlayerConnected(i)) continue;
if(IsPlayerInVehicle(i, j))
{
vehicle[j] = true;
break;
}
}
if(!vehicle[j]) SetVehicleToRespawn(j);
}
format(don, sizeof(don), "{FF0000}[Admin]{FFFFFF}Veiculos inutilizados foi resetado pelo admin{FF0000} %s{FFFFFF}.",Name);
SendClientMessageToAll(-1,don);
return 0;
}
new Name[MAX_PLAYER_NAME];