-
Posts
1,060 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Addlibs
-
If you don't understand basic English, then you best seek support in your native language forum section.
-
Which line of the extract corresponds to line 89 of the full code?
-
In the client console (F8), use /debugscript 3
-
function setteamcolor(player, cmd, hex) if ( team1 ) then if hex:sub(1,1) == "#" then outputChatBox("Incorrect syntax: Invalid HEX colour", player) end if #(hex:sub(2)) == 3 or #(hex:sub(2)) == 6 then -- ensure the hex is either 3 characters long (eg. FFF) or 6 (eg. FFFFFF) local r, g, b = getColorFromString(hex) --inject the hex to the function, with # appended in front. Returns RGB. setTeamColor(team1, r, g, b) end end addCommandHandler ( "setteamcolor", setteamcolor ) /setteamcolor #123456 will set the team colour to RGB(18,52,86)
-
If you created it you should be able to sort this out yourself. The code shows you're competent enough, and you even failed to provide the relevant /debugscript lines (if there aren't any, you could say that there are none) To summarise, please provide the relevant /debugscript lines if you expect people to help.
-
I doubt that you own any rights to this script.
-
local x = getPlayerName(killer) -- since this is the same for everyone, there's no point of defining it multiple times in the loop for plr in ipairs(getElementsByType("player")) do local y = ( victim == plr and "you" or getPlayerName(victim) ) -- if victim == the player its outputting message to, display "you", otherwise the victim's name (conditional operator, inline-IF-statement, or however you want to call this) ouputChatBox(x .. " killed " .. y, plr) end
-
num1 = guiGetText ( editbox1 ) num2 = guiGetText ( editbox1 ) Both num1 and num2 come from the same edit box, which means you're just doing editbox1 value - editbox1 value (i.e. a-a) Change line 9 to num2 = guiGetText ( editbox2 ) --editbox2 not editbox1
-
Actually, my code should work with the unmodified version of scoreboard (or more technically, dxscoreboard) - it is based on an extract from the voice resource which displays an icon on the scoreboard depending on the voice-state of a player (speaking, not speaking, muted) on the default scoreboard resource
-
can't you just use the ORDER BY function in the SQL query? SELECT column1,column2,column3 FROM table ORDER BY column1 DESC -- (ASC is default)
-
Set element data of the player, lets say, 'level_icon', to { ["type"] = "image", ["src"] = ":resource/file.ext", ["color"] = tocolor(255,255,255,255), ["width"] = 20, ["height"] = 20, } , then add a column to show level_icon element data under an unnamed column: exports.scoreboard:addScoreboardColumn("level_icon",getRootElement(),1,40," ") --Last argument, friendly name, is just a space in a string.
-
dxSetShaderTransform
-
That's because you attempt to collect p from the function in the timer but never passed a value for it in setTimer (therefore, within the timer function, p is nil). Line 58: end,5000,0,t_Element Also, inside the timer function (lines 46-57 inclusive), you should change every peds[t_Element] and t_Element into p because neither (unless declared globally) exist in the timer-attached function.
-
Trigger a client event from server for everybody, which is attached to playSound. Client: addEvent("broadcast playSound", true) addEventHandler("broadcast playSound", root, playSound) Server: triggerClientEvent(root, "broadcast playSound", resourceRoot, "sound URL", loop)
-
You can stop writing in capital letters, for a start. The code which Dimos7 sent is client-side but you need to define the position, key & state (see below) beforehand, otherwise it won't work. local x, y, z = --the co-ordinates where you want people to respawn at local key = --the key to press to respawn local state = --whether the above key should be pressed or released, "down" or "up" accordingly. --place before Dimos7's code
-
Sorry but I don't think anyone, including myself, can understand your problem. Please clarify further?
-
Line 6-7: You're looping a table that's a result from SQL, therefore no value within it is an element, therefore you should not use getElementData on line 7, but rather check the sub-value of v, for example, v.gang_name --or, v['gang_name'] --(same thing) Additionally, your second problem is that you're verifying who's from which gang without even querying the information (i.e. your SQL query does not tell you which gang who is from because you only requested to SELECT member_account and nothing else) — which is also quite useless since you've specifically told the SQL query to only retrieve members from a specific gang, so no other records will be returned - therefore, you do not need to check the gang of the record.
-
getElementParent --as long as you don't change it manually beforehand, it should be linked to the Dynamic map, which's parent is the resource it originates from, i.e.: local obj = createObject(1337, 0, 0, 0) local map = getElementParent(obj) --usually the ID of this element is the name of the map XML file, or 'dynamic' as in, created by script, not map file local resourceElement = getElementParent(map) --nota bene: Resource element is not the same as Resource userdata local resourceName = getElementID(resourceElement) --works the same as getResourceName(resourceUserdata) but right now we only have the resourceElement, not the resourceUserdata local resourceUserdata = getResourceFromName(resourceName) Then you can check if the resource matches your criteria, i.e. if the name of it is equal to something, or if it's userdata is equal to, lets say, thisResource
-
Set animation to an empty set and empty animation, i.e setPedAnimation(localPlayer, "", "") --Of course, replace localPlayer with the ped element who's animation you want to stop
-
If you look at 'MTA' (port 22133) you can see a slight bit of oncoming text - I guess it's just hidden via photo editing for privacy (though it's only a local IP), besides, you can clearly see that the ports are open and functioning correctly.
-
Self explanatory - your database table does not have a column named 'value'. Add that column into the table or correct it in the code, depending on whether it was meant to be 'value' or something else.
-
Wrong section > Try viewforum.php?f=177
-
Wrong section - try viewforum.php?f=177
-
In URLs, %20 is a space, so the server should have returned the files correctly, but I'm glad you found a solution to your problem.
-
Sync vars between client and server without triggerEvent
Addlibs replied to Stanley Sathler's topic in Scripting
I believe the only other way to sync besides triggering events is through element data. You could make a dummy element, server-side, and on it, store the table of variables, which would be both accessible to the client, and the server - however, those would be editable by client, which might be a security flaw if there's a guy who knows how to edit the data outside of MTA, though the user must be able to send a fake 'sync' packet otherwise the change will only work on his end.