COMMAND:respawncars(playerid, params[]) { if(PlayerInfo[playerid][admlvl] < 8) return SendClientError(playerid, CANT_USE_CMD); SetTimer("RespawnAll", 15000, false); SendClientMessageToAll(-1, "{ff0000}(( WARNING: {FFFFFF}Unoccupied vehicles will be respawned in 20 seconds! {ff0000}))"); PlayerLoop(i) { TDWarning(i, "Unoccupied vehicles respawn in 18 seconds.", 16000); } return 1; }
{ VehicleLoop(v) { if(VehicleInfo[v][vActive] != true) continue; if(VehicleInfo[v][vSpawned] != true) continue; if(IsVehicleOccupied(GetCarID(v))) continue; if(GetVehicleModel(GetCarID(v)) == 435 && !CanTrailerBeRespawned(GetCarID(v))) continue; SetVehicleToRespawn(GetCarID(v)); }
new LastUsedVehicle[MAX_PLAYERS]; new AntiRespawn[MAX_VEHICLES]; public OnPlayerDisconnect(playerid, reason) { LastUsedVehicle[playerid] = -1; return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER /* aka state '2' */) { LastUsedVehicle = GetPlayerVehicleID(playerid); } return 1; } CMD:stoprespawn(playerid) { if(LastUsedVehicle[playerid] == -1) return SendClientMessage(playerid, 0xFFFFFFFF, "[ERROR] You never used a vehicle in this session."); new Vehicle = LastUsedVehicle[playerid]; //Did this to avoid errors AntiRespawn[Vehicle] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] This vehicle will not respawn from now."); return 1; } //And... VehicleLoop(v) { if(VehicleInfo[v][vActive] != true) continue; if(VehicleInfo[v][vSpawned] != true) continue; if(IsVehicleOccupied(GetCarID(v))) continue; if(GetVehicleModel(GetCarID(v)) == 435 && !CanTrailerBeRespawned(GetCarID(v))) continue; if(AntiRespawn[GetCarID(v)] == 0) continue; SetVehicleToRespawn(GetCarID(v)); }
warning 213: tag mismatch
if(LastUsedVehicle[playerid] == -1) return SendClientMessage(playerid,-1, "You havent used a vehicle to stop from respawning");
Код:
warning 213: tag mismatch Код:
if(LastUsedVehicle[playerid] == -1) return SendClientMessage(playerid,-1, "You havent used a vehicle to stop from respawning"); |
CMD:stoprespawn(playerid, params[]) { if(LastUsedVehicle[playerid] == -1) return SendClientMessage(playerid, 0xFFFFFFFF, "[ERROR] You never used a vehicle in this session."); new Vehicle = LastUsedVehicle[playerid]; //Did this to avoid errors AntiRespawn[Vehicle] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] This vehicle will not respawn from now."); return 1; }
LastUsedVehicle = GetPlayerVehicleID(playerid); // LastUsedVehicle must be indexed
K0P you made a little mistake OnPlayerKeyStateChange
PHP код:
|
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER /* aka state '2' */) { LastUsedVehicle[playerid] = GetPlayerVehicleID(playerid); } return 1; }
COMMAND::stoprespawn(playerid) { if(LastUsedVehicle[playerid] == -1) return SendClientMessage(playerid, 0xFFFFFFFF, "[ERROR] You never used a vehicle in this session."); // line error 1 new Vehicle = LastUsedVehicle[playerid]; //Did this to avoid errors AntiRespawn[Vehicle] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "[INFO] This vehicle will not respawn from now."); return 1; // line error 2 }