#include <a_samp> #include <zcmd> #include <sscanf2>/* Szín definició */#define COLOR_ORANGE 0xFFA500FF/* Beállítások */#define K_TIME 2 #define Z_TIME 3/* Timerek */new vehicletimer, vehtimer;/* Forward */forward VehicleRespawn();forward CheckTimer();/* */public OnFilterScriptInit(){ print(\"**************************\"); print(\"Jármû respawnoló betöltve!\"); print(\"Készítõ: Sheet\"); SetTimer(\"CheckTimer\", 3600000, true); return 1;}public OnPlayerConnect(playerid){ SendClientMessage(playerid, COLOR_ORANGE, \"A szerver \'Sheet\' Jármû respawnoló scriptjét használja!\"); return 1;}public CheckTimer(){ new time[4]; gettime(time[0], time[1], time[2]); if(time[0] >= K_TIME && time[0] <= Z_TIME) { vehicletimer = 60; vehtimer = SetTimer(\"VehicleRespawn\", 1000, true); SendClientMessageToAll(COLOR_ORANGE, \"Minden használaton kívüli jármû repsawnolva lesz 60 másodperc mulva a rendszer által.\"); }}COMMAND:respawnallcars(playerid, params[]){ return cmd_rac(playerid, params);}COMMAND:rac(playerid, params[]){ new vehicletime; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, \"Nem vagy RCON admin!\"); if(sscanf(params, \"d\", vehicletime)) return SendClientMessage(playerid, COLOR_ORANGE, \"Használat: /r(espawn)a(ll)c(ars) [idõ]\"); vehicletimer = vehicletime; vehtimer = SetTimer(\"VehicleRespawn\", 1000, true); new string[128], sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), \"* Minden használaton kívüli jármû repsawnolva lesz %d másodperc mulva %s által.\", vehicletime, sendername); SendClientMessageToAll(COLOR_ORANGE, string); return 1;}public VehicleRespawn(){ --vehicletimer; if( !vehicletimer ) { new vehid; while(vehid < MAX_VEHICLES) { if(!IsVehicleOccupied(vehid)) { SetVehicleToRespawn(vehid); } vehid++; } KillTimer(vehtimer); return;} static string[ 3 ]; format( string, 3, \"%d\", vehicletimer ); GameTextForAll(string, 1000, 6 );}stock IsVehicleOccupied ( vehicleid ){ new i; while(i < MAX_PLAYERS) { if ( IsPlayerInVehicle ( i, vehicleid ) ) return 1; i++; } return 0;}
stock IsVehicleOccupied ( vehicleid ){ new i; while(i < MAX_PLAYERS) { if ( IsPlayerInVehicle ( i, vehicleid ) ) return 1; if(IsTrailerAttachedToVehicle(vehicleid)) return 1; i++; } return 0;}