Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Biblioteki:
- #include <a_samp>
- #include <zcmd>
- // Makra i constansy:
- #define foreach(%1) for(new %1; gPlayerIDs[%1] != INVALID_PLAYER_ID; %1++) if(IsPlayerConnected(%1))
- #define function%0(%1) forward%0(%1); public%0(%1)
- const RefreshTime = 150;
- // Zmienne:
- new
- string[16],
- PlayerText:licznik[MAX_PLAYERS],
- Text:km,
- gPlayerIDs[MAX_PLAYERS] = {INVALID_PLAYER_ID, ...},
- VehicleCmdNames[212][32] =
- {
- "/Landstalker", "/Bravura", "/Buffalo", "/Linerunner", "/Pereniel", "/Sentinel", "/Dumper", "/Firetruck", "/Trashmaster", "/Stretch",
- "/Manana", "/Infernus", "/Voodoo", "/Pony", "/Mule", "/Cheetah", "/Ambulance", "/Leviathan", "/Moonbeam", "/Esperanto",
- "/Taxi", "/Washington", "/Bobcat", "/Mr Whoopee", "/BF Injection", "/Hunter", "/Premier", "/Enforcer", "/Securicar", "/Banshee",
- "/Predator", "/Bus", "/Rhino", "/Barracks", "/Hotknife", "/Trailer", "/Previon", "/Coach", "/Cabbie", "/Stallion",
- "/Rumpo", "/RC Bandit", "/Romero", "/Packer", "/Monster", "/Admiral", "/Squalo", "/Seasparrow", "/Pizzaboy", "/Tram",
- "/Trailer", "/Turismo", "/Speeder", "/Reefer", "/Tropic", "/Flatbed", "/Yankee", "/Caddy", "/Solair", "/Berkley's RC Van",
- "/Skimmer", "/PCJ-600", "/Faggio", "/Freeway", "/RC Baron", "/RC Raider", "/Glendale", "/Oceanic", "/Sanchez", "/Sparrow",
- "/Patriot", "/Quad", "/Coastguard", "/Dinghy", "/Hermes", "/Sabre", "/Rustler", "/ZR 350", "/Walton", "/Regina",
- "/Comet", "/BMX", "/Burrito", "/Camper", "/Marquis", "/Baggage", "/Dozer", "/Maverick", "/News Chopper", "/Rancher",
- "/FBI Rancher", "/Virgo", "/Greenwood", "/Jetmax", "/Hotring", "/Sandking", "/Blista Compact", "/Police Maverick", "/Boxville", "/Benson",
- "/Mesa", "/RC Goblin", "/Hotring Racer", "/Hotring Racer", "/Bloodring Banger", "/Rancher", "/Super GT", "/Elegant", "/Journey", "/Bike",
- "/Mountain Bike", "/Beagle", "/Cropdust", "/Stunt", "/Tanker", "/RoadTrain", "/Nebula", "/Majestic", "/Buccaneer", "/Shamal",
- "/Hydra", "/FCR", "/NRG", "/HPV1000", "/Cement Truck", "/Tow Truck", "/Fortune", "/Cadrona", "/FBI Truck", "/Willard",
- "/Forklift", "/Tractor", "/Combine", "/Feltzer", "/Remington", "/Slamvan", "/Blade", "/Freight", "/Streak", "/Vortex",
- "/Vincent", "/Bullet", "/Clover", "/Sadler", "/Firetruck", "/Hustler", "/Intruder", "/Primo", "/Cargobob", "/Tampa",
- "/Sunrise", "/Merit", "/Utility", "/Nevada", "/Yosemite", "/Windsor", "/Monstera", "/Monsterb", "/Uranus", "/Jester",
- "/Sultan", "/Stratum", "/Elegy", "/Raindance", "/RC Tiger", "/Flash", "/Tahoma", "/Savanna", "/Bandito", "/Freight",
- "/Trailer", "/Kart", "/Mower", "/Duneride", "/Sweeper", "/Broadway", "/Tornado", "/AT-400", "/DFT-30", "/Huntley",
- "/Stafford", "/BF-400", "/Newsvan", "/Tug", "/Trailer2", "/Emperor", "/Wayfarer", "/Euros", "/Hotdog", "/Club",
- "/Trailer3", "/Trailer4", "/Andromeda", "/Dodo", "/RC Cam", "/Launch", "/Police Car (LSPD)", "/Police Car (SFPD)", "/Police Car (LVPD)", "/Police Ranger",
- "/Picador", "/S.W.A.T. Van", "/Alpha", "/Phoenix", "/Glendale", "/Sadler", "/Luggage Trailer", "/Luggage Trailer2", "/Stair Trailer", "/Boxville",
- "/Farm Plow", "/Utility Trailer"
- }
- ;
- // Funkcje publiczne:
- main();
- public OnGameModeInit()
- {
- km = TextDrawCreate(557.000000, 368.000000, "km/h");
- TextDrawBackgroundColor(km, 255);
- TextDrawFont(km, 3);
- TextDrawLetterSize(km, 0.200000, 0.900000);
- TextDrawColor(km, -1);
- TextDrawSetOutline(km, 1);
- TextDrawSetProportional(km, 1);
- SetTimer("SpeedoMeter", 25, true); //RefreshTime / 2, true);
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- licznik[playerid] = CreatePlayerTextDraw(playerid, 520.000000, 360.000000, "340");
- PlayerTextDrawBackgroundColor(playerid, licznik[playerid], 255);
- PlayerTextDrawFont(playerid, licznik[playerid], 3);
- PlayerTextDrawLetterSize(playerid, licznik[playerid], 0.500000, 1.900000);
- PlayerTextDrawColor(playerid, licznik[playerid], -1);
- PlayerTextDrawSetOutline(playerid, licznik[playerid], 1);
- PlayerTextDrawSetProportional(playerid, licznik[playerid], 1);
- return true;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayerTextDrawDestroy(playerid, licznik[playerid]);
- return true;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- switch(newstate)
- {
- case PLAYER_STATE_DRIVER:
- {
- PlayerTextDrawShow(playerid, licznik[playerid]);
- TextDrawShowForPlayer(playerid, km);
- }
- case PLAYER_STATE_ONFOOT:
- {
- if(oldstate == PLAYER_STATE_DRIVER)
- {
- PlayerTextDrawHide(playerid, licznik[playerid]);
- TextDrawHideForPlayer(playerid, km);
- }
- }
- }
- return true;
- }
- public OnPlayerCommandReceived(playerid, cmdtext[])
- {
- new
- vid,
- string2[64];
- for(new i = 0; i < sizeof(VehicleCmdNames); i++)
- {
- if(strfind(VehicleCmdNames[i], cmdtext, true) != -1)
- {
- if(!IsPlayerAdmin(playerid))
- {
- switch(i+400)
- {
- case 425, 432, 441, 406, 449, 464, 465, 501, 520, 537, 538, 564, 569, 570, 590, 591, 594, 606 .. 608, 610, 611: return SendClientMessage(playerid, -1, "Tego pojazdu nie możesz stworzyć nie będąc administratorem!");
- }
- }
- vid = CreateVehicleEx(playerid, i + 400, -1, -1);
- LinkVehicleToInterior(vid, GetPlayerInterior(playerid));
- SetVehicleVirtualWorld(vid, GetPlayerVirtualWorld(playerid));
- format(string2, sizeof(string2), "Tworzysz %s", VehicleCmdNames[i]);
- SendClientMessage(playerid, -1, string2);
- PutPlayerInVehicle(playerid, vid, 0);
- return false;
- }
- }
- return true;
- }
- public OnGameModeExit()
- {
- TextDrawDestroy(km);
- printf("Serwer jest wyłączany!");
- return true;
- }
- // Funkcje dynamiczne:
- function SpeedoMeter()
- {
- foreach(i)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- format(string, sizeof string, "%d", GetPlayerSpeed(GetPlayerVehicleID(i)));
- PlayerTextDrawSetString(i, licznik[i], string);
- }
- }
- }
- // Funkcje statyczne:
- stock GetPlayerSpeed(playerid)
- {
- new Float: ST[4];
- if(IsPlayerInAnyVehicle(playerid))
- GetVehicleVelocity(GetPlayerVehicleID(playerid), ST[0], ST[1], ST[2]);
- else GetPlayerVelocity(playerid, ST[0], ST[1], ST[2]);
- ST[3] = floatround(floatmul(floatmul(ST[0], ST[0]) + floatmul(ST[1], ST[1]) + floatmul(ST[2], ST[2]), 190.0));
- return floatround(ST[3]);
- }
- stock CreateVehicleEx(playerid, vehiclemodel, color1, color2)
- {
- new Float:x,Float:y,Float:z;
- new Float:facing;
- new Float:distance;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, facing);
- new Float:size_x,Float:size_y,Float:size_z;
- GetVehicleModelInfo(vehiclemodel, VEHICLE_MODEL_INFO_SIZE, size_x, size_y, size_z);
- distance = size_x + 0.5;
- x += (distance * floatsin(- facing, degrees));
- y += (distance * floatcos(- facing, degrees));
- facing += 90.0;
- if(facing > 360.0) facing -= 360.0;
- return CreateVehicle(vehiclemodel, x, y, z + (size_z * 0.25), facing, color1, color2, -1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement