Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function runString (commandstring, outputTo, source)
- local sourceName
- if source then
- sourceName = getPlayerName(source)
- else
- sourceName = "Console"
- end
- function getLocalPlayer( )
- return source
- end
- _G['source'] = source
- if getElementType(source) == 'player' then
- vehicle = getPedOccupiedVehicle(source) or getPedContactElement(source)
- car = vehicle
- end
- local notReturned
- local commandFunction,errorMsg = loadstring("return "..commandstring)
- if errorMsg then
- notReturned = true
- commandFunction, errorMsg = loadstring(commandstring)
- end
- if errorMsg then
- outputChatBoxR("Hiba: "..errorMsg, outputTo)
- return
- end
- results = { pcall(commandFunction) }
- if not results[1] then
- outputChatBoxR("Hiba: "..results[2], outputTo)
- return
- end
- if not notReturned then
- local resultsString = ""
- local first = true
- for i = 2, #results do
- if first then
- first = false
- else
- resultsString = resultsString..", "
- end
- local resultType = type(results[i])
- if isElement(results[i]) then
- resultType = "element:"..getElementType(results[i])
- end
- resultsString = resultsString..tostring(results[i]).." ["..resultType.."]"
- end
- outputChatBoxR("Eredmény: "..resultsString, outputTo)
- elseif not errorMsg then
- outputChatBoxR("Parancs lefuttatva!", outputTo)
- end
- end
- addCommandHandler("run123", function (player, command, ...)
- if not exports.ex_admin:isScripter(player) then return end
- local commandstring = table.concat({...}, " ")
- return runString(commandstring, rootElement, player)
- end)
- addCommandHandler("srun123", function (player, command, ...)
- if not exports.ex_admin:isScripter(player) then return end
- local commandstring = table.concat({...}, " ")
- return runString(commandstring, player, player)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement