Настройка команды

K.Intel

Участник
Автор темы
53
4
Версия MoonLoader
Другое
Здравствуйте, есть сокращение на команду выдачи авто, и я сделал так, что бы когда выдал, оно сразу оповестило кому я выдал, и что. Как сделать, что бы место ID игрока, писало ник, и место ID авто, брало авто из основного списка который есть, и писало его название.
По стандарту это выглядит так:
Выдал игроку с ID 7,транспорт под номером 560
А как сделать что бы писало следующим образом:
Выдал игроку Viktor_Ivanov[7],транспорт Sultan[560]


Код:
function av(arg)
lua_thread.create(function()
local id, idcar = arg:match("(%d+)%s(%d+)")
if tonumber(id) and tonumber(idcar) then
sampSendChat("/acar "..id.." "..idcar.." 0 0")
wait (30)
sampSendChat("/a Выдал игроку с ID ".. id ..",транспорт под номером ".. idcar .."")
else
sampAddChatMessage('{2ed164}[Admin Helper]:{FF0000} ERROR', -1)
wait (30)
sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Введите: /av [id] [veh]', -1)
wait (30)
sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Вы дадите игроку транспорт', -1)
end
end)
end

И типо сам список авто который идет

Код:
local vehicles = {"400 - Landstalker", "401 - Bravura", "402 - Buffalo", "403 - Linerunner", 
"404 - Perenniel", "405 - Sentinel", "406 - Dumper", "407 - Firetruck", "408 - Trashmaster", 
"409 - Stretch", "410 - Manana", "411 - Infernus", "412 - Voodoo", "413 - Pony", "414 - Mule", 
"415 - Cheetah", "416 - Ambulance", "417 - Leviathan", "418 - Moonbeam", "419 - Esperanto", 
"420 - Taxi", "421 - Washington", "422 - Bobcat", "423 - Mr Whoopee", "424 - BF Injection",
"425 - Hunter", "426 - Premier", "427 - Enforcer", "428 - Securicar", "429 - Banshee",
"430 - Predator", "431 - Bus", "432 - Rhino", "433 - Barracks", "434 - Hotknife", 
"435 - Trailer 1", "436 - Previon", "437 - Coach", "438 - Cabbie", "439 - Stallion",
"440 - Rumpo", "441 - RC Bandit", "442 - Romero", "443 - Packer", "444 - Monster", 
"445 - Admiral", "446 - Squalo", "447 - Seasparrow", "448 - Pizzaboy", "449 - Tram", 
"450 - Trailer 2", "451 - Turismo", "452 - Speeder", "453 - Reefer", "454 - Tropic", 
"455 - Flatbed", "456 - Yankee", "457 - Caddy", "458 - Solair", "459 - Berkley's RC Van", 
"460 - Skimmer", "461 - PCJ-600", "462 - Faggio", "463 - Freeway", "464 - RC Baron", 
"465 - RC Raider", "466 - Glendale", "467 - Oceanic", "468 - Sanchez", "469 - Sparrow", 
"470 - Patriot", "471 - Quad", "472 - Coastguard", "473 - Dinghy", "474 - Hermes", 
"475 - Sabre", "476 - Rustler", "477 - ZR-350", "478 - Walton", "479 - Regina", "480 - Comet", 
"481 - BMX", "482 - Burrito", "483 - Camper", "484 - Marquis", "485 - Baggage", "486 - Dozer", 
"487 - Maverick", "488 - News Chopper", "489 - Rancher", "490 - FBI Rancher", "491 - Virgo",
"492 - Greenwood", "493 - Jetmax", "494 - Hotring", "495 - Sandking", "496 - Blista Compact", 
"497 - Police Maverick", "498 - Boxville", "499 - Benson", "500 - Mesa", "501 - RC Goblin", 
"502 - Hotring Racer A", "503 - Hotring Racer B", "504 - Bloodring Banger", "505 - Rancher", 
"506 - Super GT", "507 - Elegant", "508 - Journey", "509 - Bike", "510 - Mountain Bike", 
"511 - Beagle", "512 - Cropdust", "513 - Stunt", "514 - Tanker", "515 - Roadtrain",
"516 - Nebula", "517 - Majestic", "518 - Buccaneer", "519 - Shamal", "520 - Hydra", 
"521 - FCR-900", "522 - NRG-500", "523 - HPV1000", "524 - Cement Truck", "525 - Tow Truck",
"526 - Fortune", "527 - Cadrona", "528 - FBI Truck", "529 - Willard", "530 - Forklift", 
"531 - Tractor", "532 - Combine", "533 - Feltzer", "534 - Remington", "535 - Slamvan",
"536 - Blade", "537 - Freight", "538 - Streak", "539 - Vortex", "540 - Vincent", "541 - Bullet", 
"542 - Clover", "543 - Sadler", "544 - Firetruck LA", "545 - Hustler", "546 - Intruder", 
"547 - Primo", "548 - Cargobob", "549 - Tampa", "550 - Sunrise", "551 - Merit", "552 - Utility", 
"553 - Nevada", "554 - Yosemite", "555 - Windsor", "556 - Monster A", "557 - Monster B", 
"558 - Uranus", "559 - Jester", "560 - Sultan", "561 - Stratum", "562 - Elegy", 
"563 - Raindance", "564 - RC Tiger", "565 - Flash", "566 - Tahoma", "567 - Savanna", 
"568 - Bandito", "569 - Freight Flat", "570 - Streak Carriage", "571 - Kart", "572 - Mower", 
"573 - Duneride", "574 - Sweeper", "575 - Broadway", "576 - Tornado", "577 - AT-400", 
"578 - DFT-30", "579 - Huntley", "580 - Stafford", "581 - BF-400", "582 - Newsvan", 
"583 - Tug", "584 - Trailer 3", "585 - Emperor", "586 - Wayfarer", "587 - Euros", 
"588 - Hotdog", "589 - Club", "590 - Freight Carriage", "591 - Trailer 3", "592 - Andromada", 
"593 - Dodo", "594 - RC Cam", "595 - Launch", "596 - Police Car (LSPD)", "597 - Police Car (SFPD)", 
"598 - Police Car (LVPD)", "599 - Police Ranger", "600 - Picador", "601 - S.W.A.T. Van", "602 - Alpha", 
"603 - Phoenix", "604 - Glendale", "605 - Sadler", "606 - Luggage Trailer A", "607 - Luggage Trailer B", 
"608 - Stair Trailer", "609 - Boxville", "610 - Farm Plow", "611 - Utility Trailer"}
 
  • Нравится
Реакции: MikeSandy

Akionka

akionka.lua
Проверенный
742
502
Lua:
function av(arg)
  lua_thread.create(function()
    local id, idcar = arg:match("(%d+)%s(%d+)")
    if tonumber(id) and tonumber(idcar) then
      if sampIsPlayerConnected(id) then
        local nick = sampGetPlayerNickname(id)
        sampSendChat("/acar " .. id .. " " .. idcar .. " 0 0")
        wait (30)
        sampSendChat("/a Выдал игроку " .. nick .. "[" .. id .. "] транспорт " .. vehicles[idcar])
      end
    else
      sampAddChatMessage('{2ed164}[Admin Helper]:{FF0000} ERROR', -1)
      wait (30)
      sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Введите: /av [id] [veh]', -1)
      wait (30)
      sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Вы дадите игроку транспорт', -1)
    end
  end)
end
Lua:
local vehicles = {[400] = "Landstalker", [401] = "Bravura", [402] = "Buffalo", [403] = "Linerunner",
[404] = "Perenniel", [405] = "Sentinel", [406] = "Dumper", [407] = "Firetruck", [408] = "Trashmaster",
[409] = "Stretch", [410] = "Manana", [411] = "Infernus", [412] = "Voodoo", [413] = "Pony", [414] = "Mule",
[415] = "Cheetah", [416] = "Ambulance", [417] = "Leviathan", [418] = "Moonbeam", [419] = "Esperanto",
[420] = "Taxi", [421] = "Washington", [422] = "Bobcat", [423] = "Mr Whoopee", [424] = "BF Injection",
[425] = "Hunter", [426] = "Premier", [427] = "Enforcer", [428] = "Securicar", [429] = "Banshee",
[430] = "Predator", [431] = "Bus", [432] = "Rhino", [433] = "Barracks", [434] = "Hotknife",
[435] = "Trailer 1", [436] = "Previon", [437] = "Coach", [438] = "Cabbie", [439] = "Stallion",
[440] = "Rumpo", [441] = "RC Bandit", [442] = "Romero", [443] = "Packer", [444] = "Monster",
[445] = "Admiral", [446] = "Squalo", [447] = "Seasparrow", [448] = "Pizzaboy", [449] = "Tram",
[450] = "Trailer 2", [451] = "Turismo", [452] = "Speeder", [453] = "Reefer", [454] = "Tropic",
[455] = "Flatbed", [456] = "Yankee", [457] = "Caddy", [458] = "Solair", [459] = "Berkley's RC Van",
[460] = "Skimmer", [461] = "PCJ-600", [462] = "Faggio", [463] = "Freeway", [464] = "RC Baron",
[465] = "RC Raider", [466] = "Glendale", [467] = "Oceanic", [468] = "Sanchez", [469] = "Sparrow",
[470] = "Patriot", [471] = "Quad", [472] = "Coastguard", [473] = "Dinghy", [474] = "Hermes",
[475] = "Sabre", [476] = "Rustler", [477] = "ZR-350", [478] = "Walton", [479] = "Regina", [480] = "Comet",
[481] = "BMX", [482] = "Burrito", [483] = "Camper", [484] = "Marquis", [485] = "Baggage", [486] = "Dozer",
[487] = "Maverick", [488] = "News Chopper", [489] = "Rancher", [490] = "FBI Rancher", [491] = "Virgo",
[492] = "Greenwood", [493] = "Jetmax", [494] = "Hotring", [495] = "Sandking", [496] = "Blista Compact",
[497] = "Police Maverick", [498] = "Boxville", [499] = "Benson", [500] = "Mesa", [501] = "RC Goblin",
[502] = "Hotring Racer A", [503] = "Hotring Racer B", [504] = "Bloodring Banger", [505] = "Rancher",
[506] = "Super GT", [507] = "Elegant", [508] = "Journey", [509] = "Bike", [510] = "Mountain Bike",
[511] = "Beagle", [512] = "Cropdust", [513] = "Stunt", [514] = "Tanker", [515] = "Roadtrain",
[516] = "Nebula", [517] = "Majestic", [518] = "Buccaneer", [519] = "Shamal", [520] = "Hydra",
[521] = "FCR-900", [522] = "NRG-500", [523] = "HPV1000", [524] = "Cement Truck", [525] = "Tow Truck",
[526] = "Fortune", [527] = "Cadrona", [528] = "FBI Truck", [529] = "Willard", [530] = "Forklift",
[531] = "Tractor", [532] = "Combine", [533] = "Feltzer", [534] = "Remington", [535] = "Slamvan",
[536] = "Blade", [537] = "Freight", [538] = "Streak", [539] = "Vortex", [540] = "Vincent", [541] = "Bullet",
[542] = "Clover", [543] = "Sadler", [544] = "Firetruck LA", [545] = "Hustler", [546] = "Intruder",
[547] = "Primo", [548] = "Cargobob", [549] = "Tampa", [550] = "Sunrise", [551] = "Merit", [552] = "Utility",
[553] = "Nevada", [554] = "Yosemite", [555] = "Windsor", [556] = "Monster A", [557] = "Monster B",
[558] = "Uranus", [559] = "Jester", [560] = "Sultan", [561] = "Stratum", [562] = "Elegy",
[563] = "Raindance", [564] = "RC Tiger", [565] = "Flash", [566] = "Tahoma", [567] = "Savanna",
[568] = "Bandito", [569] = "Freight Flat", [570] = "Streak Carriage", [571] = "Kart", [572] = "Mower",
[573] = "Duneride", [574] = "Sweeper", [575] = "Broadway", [576] = "Tornado", [577] = "AT-400",
[578] = "DFT-30", [579] = "Huntley", [580] = "Stafford", [581] = "BF-400", [582] = "Newsvan",
[583] = "Tug", [584] = "Trailer 3", [585] = "Emperor", [586] = "Wayfarer", [587] = "Euros",
[588] = "Hotdog", [589] = "Club", [590] = "Freight Carriage", [591] = "Trailer 3", [592] = "Andromada",
[593] = "Dodo", [594] = "RC Cam", [595] = "Launch", [596] = "Police Car (LSPD)", [597] = "Police Car (SFPD)",
[598] = "Police Car (LVPD)", [599] = "Police Ranger", [600] = "Picador", [601] = "S.W.A.T. Van", [602] = "Alpha",
[603] = "Phoenix", [604] = "Glendale", [605] = "Sadler", [606] = "Luggage Trailer A", [607] = "Luggage Trailer B",
[608] = "Stair Trailer", [609] = "Boxville", [610] = "Farm Plow", [611] = "Utility Trailer"}
 

Kolbasa241

Известный
213
57
Lua:
function av(arg)
lua_thread.create(function()
local id, idcar = arg:match("(%d+)%s(%d+)")
if tonumber(id) and tonumber(idcar) then
if sampIsPlayerConnected(id) then
local name = sampGetPlayerNickname(id)
        local vehName = getGxtText(getNameOfVehicleModel(idcar))
sampSendChat("/acar " .. id .. " " .. idcar .. " 0 0")
wait (30)
sampSendChat("/a Выдал игроку " .. name .. "[" .. id .. "] транспорт "..vehName)
end
else
sampAddChatMessage('{2ed164}[Admin Helper]:{FF0000} ERROR', -1)
wait (30)
sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Введите: /av [id] [veh]', -1)
wait (30)
sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Вы дадите игроку транспорт', -1)
end
end)
end
Вот способ проще, без всяких дополнительных массивов
Писал с телефона
 
  • Вау
Реакции: Akionka

K.Intel

Участник
Автор темы
53
4
[14:44:30.591466] (system) Session started.
[14:44:30.615467] (debug) Module handle: 615B0000

MoonLoader v.026.5-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137

Copyright (c) 2016, BlastHack Team
https://www.blast.hk/moonloader/

[C]: in function 'sampAddChatMessage'
...mes\GTA SAMP and GTA CRMP\SAMP\moonloader\reload_all.lua:11: in function <...mes\GTA SAMP and GTA CRMP\SAMP\moonloader\reload_all.lua:10>
[14:44:38.826937] (error) ML-ReloadAll: Script died due to an error. (07F13F84)
[14:46:26.405090] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:46:27.738166] (system) Admin Helper: Script terminated. (07E043CC)
[14:46:27.741167] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:46:27.741167] (debug) New script: 07E043CC
[14:46:27.742167] (error) Admin_Helper.lua: ...s\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua:99: unfinished string near '"'
[14:46:27.742167] (error) Admin_Helper.lua: Script died due to an error. (07E043CC)
[14:47:07.836460] (script) ML-AutoReboot: Loading "D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua"...
[14:47:07.836460] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:47:07.836460] (debug) New script: 07E043CC
[14:47:07.887463] (system) Admin Helper: Loaded successfully.
[14:47:56.031217] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:47:56.055218] (system) Admin Helper: Script terminated. (07E043CC)
[14:47:56.061218] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:47:56.062218] (debug) New script: 07E043CC
[14:47:56.116221] (system) Admin Helper: Loaded successfully.
[14:49:09.341410] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:49:09.433415] (system) Admin Helper: Script terminated. (07E043CC)
[14:49:09.437415] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:49:09.437415] (debug) New script: 07E043CC
[14:49:09.487418] (system) Admin Helper: Loaded successfully.
[14:49:54.328983] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:49:54.346984] (system) Admin Helper: Script terminated. (07E043CC)
[14:49:54.349984] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:49:54.349984] (debug) New script: 07E043CC
[14:49:54.401987] (system) Admin Helper: Loaded successfully.
[14:50:27.364872] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:50:27.383873] (system) Admin Helper: Script terminated. (07E043CC)
[14:50:27.386874] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:50:27.386874] (debug) New script: 07E043CC
[14:50:27.435876] (system) Admin Helper: Loaded successfully.
[14:51:22.382019] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:51:22.406021] (system) Admin Helper: Script terminated. (07E043CC)
[14:51:22.411021] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:51:22.411021] (debug) New script: 07E043CC
[14:51:22.465024] (system) Admin Helper: Loaded successfully.
[14:56:20.623078] (script) ML-AutoReboot: Reloading "Admin Helper"...
[14:56:21.906151] (system) Admin Helper: Script terminated. (07E043CC)
[14:56:21.910151] (system) Loading script 'D:\Raznoe\Games\GTA SAMP and GTA CRMP\SAMP\moonloader\Admin_Helper.lua'...
[14:56:21.910151] (debug) New script: 07E043CC
[14:56:21.959154] (system) Admin Helper: Loaded successfully.
 

K.Intel

Участник
Автор темы
53
4
1595246905680.png


Код:
function readChatlog()
    local f = assert(io.open(os.getenv('USERPROFILE') .. "/Documents/GTA San Andreas User Files/SAMP/chatlog.txt", "r"))
    local t = f:read("*all")
    f:close()
        return t
end
 

Kolbasa241

Известный
213
57
Lua:
function av(arg)
lua_thread.create(function()
local id, idcar = arg:match("(%d+)%s(%d+)")
if tonumber(id) and tonumber(idcar) then
if sampIsPlayerConnected(tonumber(id)) then
local name = sampGetPlayerNickname(tonumber(id))
        local vehName = getGxtText(getNameOfVehicleModel(tonumber(idcar)))
sampSendChat("/acar " .. id .. " " .. idcar .. " 0 0")
wait (30)
sampSendChat("/a Выдал игроку " .. name .. "[" .. id .. "] транспорт "..vehName)
end
else
sampAddChatMessage('{2ed164}[Admin Helper]:{FF0000} ERROR', -1)
wait (30)
sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Введите: /av [id] [veh]', -1)
wait (30)
sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Вы дадите игроку транспорт', -1)
end
end)
end
Попробуй
 

Kolbasa241

Известный
213
57
Lua:
function av(arg)
    lua_thread.create(function()
        local id, idcar = arg:match("(%d+)%s(%d+)")
        if tonumber(id) and tonumber(idcar) then
            if tonumber(idcar) < 400 or tonumber(idcar) > 609 then
                sampAddChatMessage("{2ed164}[Admin Helper]:{FFFFFF} Введите ID машины от 400-609", 0xFF2ed164)
            else
                if sampIsPlayerConnected(tonumber(id)) then
                    local name = sampGetPlayerNickname(tonumber(id))
                    local vehName = getGxtText(getNameOfVehicleModel(tonumber(idcar)))
                    sampSendChat("/acar " .. id .. " " .. idcar .. " 0 0")
                    wait (30)
                    sampSendChat("/a Выдал игроку " .. name .. "[" .. id .. "] транспорт "..vehName)
                end
            end
        else
            sampAddChatMessage('{2ed164}[Admin Helper]:{FF0000} ERROR', 0xFF2ed164)
            wait (30)
            sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Введите: /av [id] [veh]', 0xFF2ed164)
            wait (30)
            sampAddChatMessage('{2ed164}[Admin Helper]:{FFFFFF} Вы дадите игроку транспорт', 0xFF2ed164)
        end
    end)
end
100% работает, сейчас посидел и сделал. Могу ошибаться с айди машин, сам поменяешь, не помню какой айди машины максимальный.