-
Posts
1,143 -
Joined
-
Last visited
-
Days Won
42
Everything posted by Patrick
-
Every vehicle have different textures. (different texture names) You can find it. (Example: Load .txd file to TXD Workshop and here you can find the texture names.) (Download: https://www.gtagarage.com/mods/show.php?id=8320)
-
dxCreateShader dxCreateTexture dxSetShaderValue engineApplyShaderToWorldTexture
-
Szerintem nem az MTA funkcióval van a baj, szimplán az API nem jó (vagy nem jól van használva) és néha csak azt az oldalt hozza be ahol a letöltés gomb van és nem a direct letöltést. English: I think the api is wrong, because sometimes it's open the download page and not the direct download link.
-
for _, player in ipairs(getElementsByType("player")) do if isAdmin then -- here the the condition (getElementData or isObjectInACLGroup or something like that) outputChatBox("text to admins", player) else outputChatBox("text to normal players", player) end end
-
"but for some reason using your 100 works"
-
setTimer(function () setPedAnimation (charPed[1], "ped", "SEAT_idle", -1, true, false, false ) end, 100, 1) and setTimer(setPedAnimation, 100, 1, charPed[1], "ped", "SEAT_idle", -1, true, false, false) are same.
-
I have no idea.
-
setTimer(setPedAnimation, 100, 1, charPed[1],"ped","seat_idle",-1,false) Use a little delay after createPed.
-
skinsShaders = { { skinTo = "RIP", texture = "jpg2/278", worldname = "Sbmotr2", skinID = 134 }, { skinTo = "RIP", texture = "jpg2/298", worldname = "swmotr5", skinID = 230 }, } function sendDatas() triggerClientEvent("applyTheShaderOnSkin", root, skinsShaders) end setTimer(sendData, 5000, 1) addEvent("applyTheShaderOnSkin", true) function applyTheShaderOnSkin(table) for _, value in ipairs(table) do local skinTo = value.skinTo local textureName = value.worldname local texturePath = value.texture -- use variables end end addEventHandler("applyTheShaderOnSkin", root, applyTheShaderOnSkin)
-
It's looks good. But the onClientRender is missing. addEventHandler("onClientRender", root, panel)
-
You want to define the default page? Example: the login page? local pageName = "login" function render() if pageName == "login" then -- draw login page elseif pageName == "register" then -- draw register page elseif pageName == "news" then -- draw news page end end addEventHandler("onClientRender", root, render) function addPanel(clickpanel, state) if clickpanel == "left" and state == "down" then if cursorPosition(x*213, y*64, x*240, y*140) then pageName = "news" elseif cursorPosition(x*213, y*206, x*240, y*140) then pageName = "login" elseif cursorPosition(x*213, y*348, x*240, y*140) then pageName = "register" end end end addEventHandler("onClientClick", getRootElement(), addPanel)
-
-- SERVER SIDE rules = { [1] = {description = "Trash talking", punishment = "kick"}, [2] = {description = "Lot of trash talking", punishment = "ban"}, } addCommandHandler("punish", function(player, cmd, ruleID, targetPlayerName) local ruleID = tonumber(ruleID) if rules[ruleID] then -- valid rule id local targetPlayerElement = getPlayerFromName(targetPlayerName) if targetPlayerElement then -- target found local description = rules[ruleID].description local punishment = rules[ruleID].punishment local adminName = getPlayerName(player) if punishment == "kick" then kickPlayer(targetPlayerElement) outputChatBox(targetPlayerName.." kicked from server! (Reason: "..description..")", root) elseif punishment == "ban" then banPlayer(targetPlayerElement) outputChatBox(targetPlayerName.." banned from server! (Reason: "..description..")", root) end else outputChatBox("target player not found", player) end else outputChatBox("invalid rule id", player) end end)
-
Do not quite understand
-
I said, you call the addEventHandler 2 times. Find where you call it 2th time. But I think a better solution if you use only 1 clientRender. Like this: local pageName = false function render() if pageName == "login" then -- draw login page elseif pageName == "register" then -- draw register page elseif pageName == "news" then -- draw news page end end addEventHandler("onClientRender", root, render) function addPanel(clickpanel, state) if clickpanel == "left" and state == "down" then if cursorPosition(x*213, y*64, x*240, y*140) then pageName = "news" elseif cursorPosition(x*213, y*206, x*240, y*140) then pageName = "login" elseif cursorPosition(x*213, y*348, x*240, y*140) then pageName = "register" end end end addEventHandler("onClientClick", getRootElement(), addPanel)
-
You called the addEventHandler twice. Example: You open the login page with the news, BUT the news already handled. It's not critical error, only spamming the debug with warning.
-
local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() ids = {} for _, player in ipairs(getElementsByType("player")) do local id = getElementData(player,"id") if id then ids[id] = player end end end addEventHandler("onResourceStart",resourceRoot,startup) function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerID ( player ) return getElementData( player, "id") end function getPlayerFromId ( theID ) if theID then local theID = tonumber(theID) for _,player in ipairs(getElementsByType("player")) do if getElementData(player ,"id") == theID then return player end end return false else return false end end
-
muteTimers = {} interval = 20000 function findPlayerBySerial(serial) for _, player in ipairs(getElementsByType("player")) do if getPlayerSerial(player) == serial then return player end end return false end addEvent("mutePlayer", true) addEventHandler("mutePlayer", root, function() local name = getPlayerName(source) local serial = getPlayerSerial(source) outputChatBox(name.." has been muted by console for spamming.", root, 255, 100, 100) setPlayerMuted(source, true) muteTimers[serial] = setTimer(function() local player = findPlayerBySerial(serial) if player then setPlayerMuted(player, false) local name = getPlayerName(player) outputChatBox(name.." has been unmuted by console.", root, 100, 255, 100) end end, interval, 1) end) addEventHandler("onPlayerJoin", root, function() local serial = getPlayerSerial(source) if isTimer(muteTimers[serial]) then local name = getPlayerName(source) outputChatBox(name.." has been muted by console.", root, 255, 100, 100) setPlayerMuted(source, true) end end)
-
You can only remove it with script. removeWorldModel And you can find the model id and the pos with SA:MP Editor.
-
You used a point instead of a comma. "INSERT INTO vehicles (model, x, y, z) VALUES (?,?,?,?)"
-
Something like that -- SERVER local changeStateDelay = 30000 -- 30 sec delay between changes local state = false -- current state setTimer(function() state = not state triggerClientEvent(root, "changeGrenadeState", root, state) end, changeStateDelay, 0) -- CLIENT addEvent("changeGrenadeState", true) addEventHandler("changeGrenadeState", root, function(newState) if newState then -- enable addEventHandler("onClientRender", root, dxDrawC) else removeEventHandler("onClientRender", root, dxDrawC) end toggleControl("fire", newState) end)
-
https://wiki.multitheftauto.com/wiki/SetPlayerWantedLevel
-
local state = false local sound = false bindKey("m", "down", function() if state then state = false stopSound(sound) else state = true sound = playSound("example.mp3", true) end end)
- 1 reply
-
- 1
-
-
I don't know what you mean, but maybe you want this: https://wiki.multitheftauto.com/wiki/Easing
-
[SOLVED] Generate random license plate text on vehicle creation
Patrick replied to Stealthy Serval's topic in Scripting
Does it matter to be unique? Can two different vehicles have the same license plate? If don't matter: local characters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} function createRandomPlateText() local plate = "" for i = 1, 3 do plate = plate..characters[math.random(1, #characters)] end plate = plate.."-" for i = 1, 3 do plate = plate..math.random(1, 9) end return plate end