05.11.2013, 18:47
Quote:
quando eu do /rvs respawn todos os carros, tem como ajuda para Respawn so os sem uso
if(!strcmp(cmd,"/rvs", true) && pAdmin[playerid] >= 2) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, MAX_PLAYER_NAME); format(string, sizeof(string),"* O Administrador %s(%d) respawnou os veiculos sem uso", pname, playerid); SendClientMessageToAll(adm, string); new carro = 0; for(carro = 0; carro < MAX_VEHICLES; carro++) { if(!IsVehicleOccupied(carro)) SetVehicleToRespawn(carro); } return 1; } |
Код:
if (strcmp(cmd, "/rvs",true) == 0){ new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); format(file, sizeof(file), PASTA_CONTAS, aname); if(pAdmin[playerid] > 0){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, MAX_PLAYER_NAME); format(string, sizeof(string), "{00FF00}(INFO) O Administrador %s (%d) respawnou os Veiculos sem Uso.", pname,playerid); SendClientMessageToAll(adm, string); for(new v; v<MAX_VEHICLES; v++) if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v); SendClientMessage(playerid, Verde, "(INFO) Veiculos Respawnados"); proximocarro = 0; for(new carro = 0; carro < MAX_CARROS; carro++) { format(string, sizeof(string), "carro%d.ini", carro); if(dini_Exists(string)){ new carroid; DestroyVehicle(dini_Int(string, "Id")); carroid = AddStaticVehicle(dini_Int(string, "Modelo"), dini_Float(string, "CordX"), dini_Float(string, "CordY"), dini_Float(string, "CordZ"), dini_Float(string, "Angulo"), dini_Int(string, "Cor1"), dini_Int(string, "Cor2")); dini_IntSet(string, "Id", carroid); proximocarro++; } } return 1; } }
Код:
IsVehicleOccupied(vid) { for(new i; i < GetMaxPlayers(); i++) { if(!IsPlayerConnected(i)) continue; if(GetPlayerVehicleID(i) == vid) return true; } return false; }
Creditos : Não Lembro Nick