-
Posts
353 -
Joined
-
Last visited
-
Days Won
3
Everything posted by LoPollo
-
store the timer in a table (or a variable but i doubt that you will use only 1 vehicle at time) and kill it when entering the "non static veh" and start it after exiting PS: i don't understand all the login in the code... is it only a piece? Could something like this work (the function isvehstatic is edited a bit)? check it all it's not tested local timers = {} function onVehicleEnterHandler(thePlayer, seat, jacked) local theVehicle = source if isTimer( timers[theVehicle] ) then killTimer( timers[theVehicle] ) end end addEventHandler( "onVehicleEnter", root, onVehicleEnterHandler) function onVehicleExitHandler(thePlayer, seat, jacked) local theVehicle = source timers[theVehicle] = setTimer( isVehicleStatic(theVehicle) and respawnVehicle or destroyElement, 60000, 1, theVehicle ) end addEventHandler( "onVehicleExit", root, onVehicleExitHandler) function isVehicleStatic(theVehicle) if isElement( theVehicle ) and getElementType( theVehicle ) == "vehicle" then if getElementID(theVehicle):find("server_") then return true end end return false end
-
Marking as resolved a topic
LoPollo replied to LoPollo's topic in Site/Forum/Discord/Mantis/Wiki related
Thanks for your reply! So this feature is not available in all sub-forums, like the scripting one (however it is enabled in the tutorials sub-forum). I could suggest enabling it in the scripting forum... but i agree with bonsai on this... maybe it's better to only have the option to "append" to a post and to edit the title (or only the mark) Or maybe it's also possible to NOT give that permission to users, but... for example in topic marked with [HELP] (and similar) check if a "command" has been posted from the OP like #resolved, automatically changing the mark in the title if it does exist -
Marking as resolved a topic
LoPollo replied to LoPollo's topic in Site/Forum/Discord/Mantis/Wiki related
And that's in the old forum... and now? it's planned to be reimplemented? -
I have just tested, forget what i said That was a work for onElementCreated if it had a parameter for the player that caused the element to be created... but it does not exist
-
It's a shot in the dark, but did you try getElementParent? I did not test and i don't know the answer right now
-
From a quick search i can't find it so i'm asking here hoping it's the right place. I can see some topic marked as resolved ( with [RESOLVED] in the title), but i can't find a way to edit the title. Has this been already discussed? Was this "feature" removed for some reason? If a topic marked as [HELP] for example could be marked as resolved we could simply not read all the latest messages to understand its status, but we could know this from the "list" seeing it in the title.... but i think this argument does not need explanation... so tell me what happened if somehting happened or why not if this option has never been there
-
The elements in MTA are listed here, and they are: So excluding elements like gui, browser, fonts etc the following remain: And since the visibility has a meaning only in serverside we have but i can't see why the function should logically work with some... like server console the wiki states This is because these objects are required for accurate sync so we do not have players, vehicles, peds (not sure but you stated the above so i assume is true), objects. So the elements that work with this function may be these: Still, i'm to lazy to test
- 1 reply
-
- 1
-
-
server line 92: cancelEvent seems to not work therefore every chat message will be outputted twice. BUT that's not a script fault. I decided to test starting from zero: tried the wiki example #2 and it does not work, calling wasEventCancelled returns false ( so the event was not cancelled)... i never used this kind of functions with the chat but i'm sure that's not the way they should work... so probably i'm missing something BIG or we found a BUG Let's see if other people can say something about it... i honestly don't know how to handle it, and i can't find anything about this on mantis Also i'm tired now, and lots of times i can't see what's below my nose (it sounds so bad in english, does this exists in this language? it means i can't see something obvious), maybe that's the case...
-
So your labels are identified from the faction number? And the faction number of the veh is that number You can loop all the vehs looking for the one where the elementData about faction of the current veh is equal to the number of the faction clicked Here's an example local factionID = 3 --example of the id of the faction veh we have to find for k,theVehicle in pairs(factionsVehicles) do if getElementData( theVehicle, "faction" ) == factionID then --we got our veh break end end --enclosing this in a func: function getVehicleFromFactionID(theFactionID) for k,theVehicle in pairs(factionsVehicles) do if getElementData( theVehicle, "faction" ) == factionID then return theVehicle end end return false end let me know if this idea is correct
-
ok so post the handler function of onPlayerChat. also check if there are warnings or errors both serverside and clientside
-
just to make sure, does stopping the resource of the chat prevent this?
-
yes, but is this in the default chat or in the resource-chat? or both?
-
Tell me if i understand: when you send a message via chat it is handled (and displayed) by both the default chat and your resource? Could this help?
-
With "new chat resource" do you mean a resource that replace the default chatbox? if it's handling onPlayerChat then post here or a new topic the handler function
-
dxDrawText(name.." is requesting Medical Assistance in "..location,x(914.0),y(453.0+rand),x(1322.0),y(504.0),tocolor(0,205,0,theAlpha),x(1.3),"default-bold","center","center",false,false,false) i don't understand the other arguments so i'm omitting them Edit: OMG i'm blind sry did not see the functions below the handler function, edited the above code
-
check line 9: the string is not correct and highlighted syntax makes it obvious also i'm not sure if things like x(914.0) can be "accepted" from lua
-
I can't see why it gives you the warning if you edited the acl and then all the groups are found is the warning the same? WARNING: admintag\server.lua:98: Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean] I still suggest to add the default groups to the script to prevent a player in these groups (defined in the acl but not in the script) gets not properly handled
-
settings['adminTag']['ACL'] is a table of tables starting with the string of an acl group these are the groups defined in the script { 'serverowner', '#FFFF00Server Owner ' }, { 'HQStaff', '#FFFF00HQ STAFF ' }, { 'Administrator', '#FFFF00Administrator ' }, { 'SeniorMod', '#FFFF00Senior Mod ' }, { 'Modgroup', '#FFFF00Moderator ' }, { 'Probationary', '#FFFF00Probationary ' }, { 'Scripter', '#FFFF00Scripter ' }, { 'Mapper', '#FFFF00Mapper ' }, { 'Premium', '#FF0000[Premium] '}, { 'VIP', '#9900FF[VIP] '}, { 'dp', '#00FFFFVeteran '}, { 'Everyone', ' ' } They are supposed to be valid: so the only reason for aclGetGroup to return false is that, even if the "syntax" is valid, the group does not exists. By default MTA has these groups: (source) Everyone Moderator SuperModerator Admin Console RPC so when the script tries to find the group that are not specified in the acl.xml file the aclGetGroup returns false and the problem starts. So if until now i did not forgot anything and didn't make any error, there are these solutions: Add a check to the script: if the group does not exists then for sure there are no players in it Edit the part of the script where the groups are defined (the part i posted above) Edit the acl (when server is off) adding these groups A mix of these is also possible. Notes: with the first solution players in groups that are not defined within the script will cause problems, so i recommend the second solution
-
What @iPrestege said is true, but i was already testing: In the cliend you can't declare a variable called "type" since it's already a predefined lua function. Rename them. Also i made some errors at line 3 serverside: i didn't want to set root as sourceelement and setting resourceRoot will cause the resource to not work Also do not trigger events during res start since the clientside may not be already started, use a timer to call triggerClientEvent to ensure the client is ready to accept the trigger function addNotification(thePlayer, theText, theType)--i dunno if you can declare it as "type" since it's a lua func if (thePlayer and theText and theType) then for k, playerElement in pairs(getElementsByType("player")) do --use a timer to let the client side start and then accept the event setTimer( triggerClientEvent, 200, 1, playerElement, "addNotification", thePlayer ~= root and thePlayer or playerElement, theText, theType )--make sure client restart before calling end end end function onResourceStartHandler(theRes) exports[getResourceName(resource)]:addNotification(root, "Test", "success") end addEventHandler("onResourceStart", resourceRoot, onResourceStartHandler)
-
Is something like this what you want (not tested)? I don't know exactly what you want to achieve function addNotification(thePlayer, theText, theType)--i dunno if you can declare it as "type" since it's a lua func if (thePlayer and theText and theType) then triggerClientEvent(thePlayer, 'addNotification', thePlayer == root and resourceRoot or thePlayer, theText, theType)--do not set to root the sourceElement if you are sending to all players end end function onResourceStartHandler(theRes) exports[getResourceName(resource)]:addNotification(root, "Test", "success") end addEventHandler("onResourceStart", resourceRoot, onResourceStartHandler)
-
@Gravestone i'm more interested about the content of settings['adminTag']['ACL'] It should be a table containing tables starting with the string of the acl group: if this is defined somewhere, it would be helpful seeing it. Otherwise are required all the functions that access this variable, with all the functions that calls these function, and all these functions that call these... basically all the script
-
Just a thought, but if the codes posted above do not work for you... maybe there's another resource forcing the engine on? Are you trying the resource in a default server (no other resource other than defaults ones)? If not, try stopping all resources. Check if it works. If it works, start one resource at a time and check everytime if it works. If you have lots of resources, you can start them in blocks, and when you encounter the problem, probably the resource that is causing the problem is in that block of resources. If no resource causes problem (it does not work even if all non-default res are stopped) then i'm missing something If i understood correctly, when he turns off the engine it automatically turns on again. @griff316 but what @iPrestege said lead me to think one thing: what happens if you (via script) turn off the engine when you are not in the vehicle (if you are testing while in it) (or inside it if you are testing when you are not in the vehicle)? (do not do this if you do not want to, it's optional. Do what i wrote above first)
-
The string in v[1] (where v is every value of settings['adminTag']['ACL'] ) is not a valid ACL group (and therefore the aclGetGroup returns false). You could try adding an outputChatBox (or equivalent) to see what v[1] contain: for _,v in ipairs(settings['adminTag']['ACL']) do outputChatBox(v[1]) if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text Is the outputted value supposed to be an acl group? And is it a string in first place?
-
the code i provided is working for me, but the default gravity is 0.008 ( not 0.0008 ) btw i do have an element at argument 1, are you sure u copied the code? (maybe you edited and forgot something, dunno)
