myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
40
Everything posted by myonlake
-
setElementData((getPlayerFromName("Joris") and getPlayerFromName("Joris") or (getPlayerFromName("joriss11") and getPlayerFromName("joriss11") or nil)), "Chief", true, false) -- Uncomment this in order to make yourself a chief
-
If the element data value is "LV1", "LV2"... then you have to change the string.gsub's second argument to match "LV" or so.
-
This actually makes no sense. It should work. I have debugged it as far as I can and setting team and fetching team works server-side, but doesn't work on client-side. I guess this is a bug then, I'll report to Mantis unless I can find the reason. Also, I made the synchronization work, the hit element should be moved away properly for all players now (not sure if it was the issue before, but just to make sure. Here's a small workaround. Client-side addEventHandler("onClientPlayerWeaponFire", root, function(weapon, _, _, _, _, _, hitElement) if (getElementData(localPlayer, "players.team")) and (getElementData(localPlayer, "players.team") == "Staff") then if (hitElement) and (getElementType(hitElement) == "player") then triggerServerEvent("sendPlayerAway", hitElement) end end end ) Server-side addEventHandler("onResourceStart", resourceRoot, function() for _,player in ipairs(getPlayersInTeam(getTeamFromName("Staff"))) do setElementData(player, "players.team", "Staff", true) end end ) local posX, posY, posZ = 0, 0, 3 addEvent("sendPlayerAway", true) addEventHandler("sendPlayerAway", root, function() setElementPosition(source, posX, posY, posZ) end )
-
Apparently it's just a random error whenever the rendering process begins, but that's normal behavior as the image isn't loaded yet. You can add a fileExists() function there if you want, but the image should still display. I tested it myself and it works just fine. Make sure the element data is similar to this: "Lvl 1", "Lvl 2" and so on, otherwise the gsub doesn't work.
-
http://en.wikibooks.org/wiki/Lua_Progra ... ua/comment
-
As far as I can tell from the replies, it's a system that connects MTA with a web system that lists users or something on a website. Nothing fancy as you probably get better results nowadays with the webpanel/webadmin resource.
-
What's the full error. It should display the file path. Apparently there is no file in the path specified. Also, make sure you've added the file into the meta.xml.
-
In order to debug it, uncomment the first line of code. It will set your element data to the same as the vehicle's data. Also, where does your spawner set the element data? Client-side or server-side?
-
Then your element data is wrong. Make sure the two element datas (vehicle and you) are identical. The script I posted sets the element data value to a boolean value 'true'.
-
What resources are you running at the moment?
-
You were missing an end in the onClientGUIClick event. local Manster = { "spawn", "bank", } local screX, screY = guiGetScreenSize() Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) guiWindowSetSizable(Wind, false) guiSetVisible(Wind, false) GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) guiGridListAddColumn(GRID, "spawn :", 0.9) for i=1,15 do guiGridListAddRow(GRID) end guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) guiGridListSetItemText(GRID, 2, 1, "bank", false, false) Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) addEventHandler("onClientGUIClick", root, function() if (source == Select) then local row, col = guiGridListGetSelectedItem(GRID) local SS = guiGridListGetItemText(GRID, row, col) if (SS) then guiSetVisible(Wind, false) guiSetInputEnabled(false) if (SS == "spawn") then triggerServerEvent("spawn", localPlayer, "spawns") elseif (SS == "bank") then triggerServerEvent("spawn2", localPlayer, "spawns2") elseif (source == Close) then guiSetVisible(Wind, false) guiSetInputEnabled(false) end end end end, false ) function showGui() guiSetVisible (Wind, true) showCursor (true) end bindKey("F2", "down", showGui) addEvent("open", true) addEventHandler("open", root, function(state) if (state == "true") then guiSetVisible(Wind, true) guiSetInputEnabled(true) elseif (state == "false") then guiSetVisible(Wind, false) guiSetInputEnabled(false) end end ) Works just fine on Lua demo as well (link ») local Manster = { "spawn", "bank", } local function runScript() local screX, screY = guiGetScreenSize() Wind = guiCreateWindow(screX / 2 - 100, screY / 2 - 150, 200, 350, "By Manster", false) guiWindowSetSizable(Wind, false) guiSetVisible(Wind, false) GRID = guiCreateGridList(0, 0.07, 1, 0.66, true, Wind) guiGridListAddColumn(GRID, "spawn :", 0.9) for i=1,15 do guiGridListAddRow(GRID) end guiGridListSetItemText(GRID, 1, 1, "spawn", false, false) guiGridListSetItemText(GRID, 2, 1, "bank", false, false) Select = guiCreateButton(0.05, 0.75, 1, 0.1, "Select!", true, Wind) Close = guiCreateButton(0.05, 0.86, 1, 0.1, "Close", true, Wind) addEventHandler("onClientGUIClick", root, function() if (source == Select) then local row, col = guiGridListGetSelectedItem(GRID) local SS = guiGridListGetItemText(GRID, row, col) if (SS) then guiSetVisible(Wind, false) guiSetInputEnabled(false) if (SS == "spawn") then triggerServerEvent("spawn", localPlayer, "spawns") elseif (SS == "bank") then triggerServerEvent("spawn2", localPlayer, "spawns2") elseif (source == Close) then guiSetVisible(Wind, false) guiSetInputEnabled(false) end end end end, false ) function showGui() guiSetVisible (Wind, true) showCursor (true) end bindKey("F2", "down", showGui) addEvent("open", true) addEventHandler("open", root, function(state) if (state == "true") then guiSetVisible(Wind, true) guiSetInputEnabled(true) elseif (state == "false") then guiSetVisible(Wind, false) guiSetInputEnabled(false) end end ) print("Works!") end function addEvent() return true end function guiGetScreenSize() return 1920, 1080 end function guiCreateWindow() return true end function guiWindowSetSizable() return true end function guiSetVisible() return true end function guiCreateGridList() return true end function guiGridListAddColumn() return true end function guiGridListAddRow() return true end function guiGridListSetItemText() return true end function guiCreateButton() return true end function guiSetProperty() return true end function addEventHandler() return true end function guiGridListGetSelectedItem() return true end function guiGridListGetItemText() return true end function guiSetInputEnabled() return true end function triggerServerEvent() return true end function showCursor() return true end function bindKey() return true end runScript()
-
Either you're not using the code client-side or you didn't use M4 when testing. I removed the weapon ID so you can shoot them with any weapon. Client-side local posX, posY, posZ = 0, 0, 3 addEventHandler("onClientPlayerWeaponFire", root, function(weapon, _, _, _, _, _, hitElement) if (getPlayerTeam(localPlayer) and getTeamName(getPlayerTeam(localPlayer)) == "Staff") then if (hitElement) and (getElementType(hitElement) == "player") then setElementPosition(hitElement, posX, posY, posZ) end end end )
-
You made createVehicle a variable index. You're supposed to make variable for the createVehicle function instead. You also never defined the function within the event handler. Also, there is no "class" vehicle defined in the function. The vehicle is defined "source" by the Wiki. --setElementData(getPlayerFromName("yournickhere"), "Chief", true, false) -- Uncomment this in order to make yourself a chief local vehicle = createVehicle(506, 2100.2697, 1397.4947, 10.3, 0, 0, 0) -- Create the vehicle setElementData(vehicle, "Chief", true, false) -- Give it element data in 'Chief' and make its value a boolean 'true' addEventHandler("onVehicleStartEnter", root, function(thePlayer, seat, jacked, door) local vehicleOwner = getElementData(source, "Chief") -- Get the vehicle's element data on 'Chief' local gangGroup = getElementData(thePlayer, "Chief") -- Get the entering player's element data on 'Chief' if (not vehicleOwner) then return end -- If the vehicle doesn't have such data, then cancel if (gangGroup ~= vehicleOwner) then -- If the entering player's data doesn't match the vehicle data, continue outputChatBox("This car is locked and belongs to the following class: Chief", thePlayer, 245, 20, 20, false) -- Display a warning cancelEvent() -- Prevent the player from entering the vehicle end end )
-
Switch the getLocalPlayer in the event handler to "root".
-
Making a separate drawing system is like learning a new language. It's precise and takes time. If you ever wanted to do it, learn to do the basics first. Use the functions you can find from the drawing functions on client-side functions in Wiki. Make a script and if it doesn't work, come back.
-
You can make it with tables though, but that's just a workaround on it (simply put: you make your own drawing method by making a table that draws the elements and you can define element parents in that table). But it's just about your motivation on how far you're going to go with it.
-
Not completely sure - haven't used the Map Editor lately. I've seen these only on MTA as far as I can remember. Normal GTA never displays these Russian letters. I'll try to get a screenshot right when it happens if I can.
-
Hey, I don't know why this happens, but randomly when I join a server for the first time after I've started Multi Theft Auto, the game displays the view of Los Santos and then some huge font with Russian text on it, just for like 400 ms. Is this a thing that MTA does or is it about GTA:SA or something? I thought it had something to do with the in-game textures that aren't loaded properly yet, so they show up on screen for some reason. It only happens sometimes and only when I join a server for the first time after I've started MTA, so I guess it has something to do with loading.
-
If you're running play or race or another gamemode, they might have those resources included in their meta.xml file.
-
btw what will this be? a userdata? can I check with this, if the one that did send it, is still in the server? Just to answer the question: it will return the client that called the event. If you trigger some server-side event from client-side, the client will be the player who triggered the server-side event. This is useful for checking element data hacks and similiar. Quite a helpful thing with security.
-
As far as I know it is not illegal in any laws of the U.S. or in terms of Rockstar Games to provide add-ons to their games. It's not a conversion, it's not an overhaul, but I would say an add-on as it's optional. I also doubt Rockstar Games really cares as GTA V online probably has 10 times more users online than in MTA, maybe even 20. I don't know how many were sold. Even if it is to be taken as a conversion, they still include all Rockstar Games copyrights and notifications and MTA:SA is doing this for total promotion reasons and so on. It would be a loss for Rockstar Games and not a win, if they decided to take MTA/SAMP down. MTA and SAMP have increased the amount of copies sold, giving them legit profit and mod developers get nothing, except the "permission" to keep going on. MTA developers can be bribed via Mantis in order to speed up the process of fixing a bug or feature they really want implemented.
-
Yeah, maybe I was trying to do a bit much for a first script. Thank you so much for your help. You're welcome.
-
Since MTA:SA build r5862 you are able to do it without doing any queries after the initial query. Here is the Wiki example. local result, num_affected_rows, last_insert_id = dbPoll ( qh, -1 ) if result == nil then outputConsole( "dbPoll result not ready yet" ) elseif result == false then local error_code,error_msg = num_affected_rows,last_insert_id outputConsole( "dbPoll failed. Error code: " .. tostring(error_code) .. " Error message: " .. tostring(error_msg) ) else outputConsole( "dbPoll succeeded. Number of affected rows: " .. tostring(num_affected_rows) .. " Last insert id: " .. tostring(last_insert_id) ) end