-
Posts
866 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Mr_Moose
-
That's true, pickups doesn't react on vehicles, that's why I suggested an object with colshape, try the latest code sequence and remember to go away a bit first and then hit the object because the colshape in my example is pretty big.
-
I think Deagle is held with two hands, another gun thought but still similar to colt if that's any help.
-
Yeah I missed that ')' om line 27 I see. Those errors can't be taken literally obviously. local star = nil local area = nil function nostar() setTimer(function() if isElement(star) then destroyElement(star) end if isElement(area) then destroyElement(area) end star = createObject (1247, 653.35773, -1769.18567, 13.57368 ) area = createColRectangle ( 648.35773, -1774.18567, 10, 10 ) addEventHandler ( "onColShapeHit", area, function( hitElement, matchingDimension ) if getElementType ( hitElement ) == "player" then if getPlayerWantedLevel(hitElement) > 0 then setPlayerWantedLevel(hitElement,getPlayerWantedLevel(hitElement)-1) destroyElement(star) end elseif getElementType ( hitElement ) == "vehicle" then local player = getVehicleOccupant(hitElement) if player and getPlayerWantedLevel(player) > 0 then setPlayerWantedLevel(hitElement,getPlayerWantedLevel(player)-1) destroyElement(star) end end end) end,60000,0) end addEventHandler("onResourceStart",resourceRoot,nostar)
-
It's correct except for those commas at the end of each table line, this will work. -- List of commands to disable cmdList = { ["register"]=true, ["login"]=true, -- Don't forget the comma at the end of this and the below line. ["me"]=true, ["say"]=true } -- Disable unwanted commands addEventHandler("onPlayerCommand", root, function(cmdName) if cmdList[cmdName] then cancelEvent() end end) It's also commands that triggers the onPlayerChat event, but you're right, the say command is used with the chatbox command so it won't work to disable those in this event probably. Many roleplay servers removes the main chat as far as I know so it makes sense.
-
Sure, it's easy. This solution is based on the sample by Twerky with a few modifications. It's not tested thought but it should work. Good luck. local star = nil local area = nil function nostar() setTimer(function() if isElement(star) then destroyElement(star) end if isElement(area) then destroyElement(area) end star = createObject (1247, 653.35773, -1769.18567, 13.57368 ) area = createColRectangle ( 648.35773, -1774.18567, 10, 10 ) addEventHandler ( "onColShapeHit", area, function( hitElement, matchingDimension ) if getElementType ( hitElement ) == "player" then if getPlayerWantedLevel(hitElement) > 0 then setPlayerWantedLevel(hitElement,getPlayerWantedLevel(hitElement)-1) destroyElement(star) end elseif getElementType ( hitElement ) == "vehicle" then local player = getVehicleOccupant(hitElement) if player and getPlayerWantedLevel(player) > 0 then setPlayerWantedLevel(hitElement,getPlayerWantedLevel(player)-1) destroyElement(star) end end end end,60000,0) end addEventHandler("onResourceStart",resourceRoot,nostar)
-
All the given examples works but not if they are used wrongly, see the wiki documentation for the event, onPickupHit: It will work for players but not if you're inside a vehicle. I would suggest creating this as an object and add a colshape around it, colshapes trigger on any type of element. The handling with respawns and stuff like that needs to be done manually but that won't be any problem, I've already seen a few samples in here which applies this kind of handling on the pickup which is just waste of server performance.
-
Good idea actually, I'll have a look at it tomorrow.
-
It's correct but you could add both the "if" statements into the same command handler like this: -- List of commands to disable cmdList = { ["register"]=true, ["login"]=true } -- Disable unwanted commands addEventHandler("onPlayerCommand", root, function(cmdName) if cmdList[cmdName] then cancelEvent() end end) And then, why not improve it further by adding the commands to a table to make it easier to add even more commands you might want to disable.
-
last_msg = {} addEventHandler ( "onPlayerChat", root, function ( message, tp ) if last_msg[source] and last_msg[source] == message then cancelEvent ( ) end -- Optinal disable "me" chat completly if ( tp == 1 ) then cancelEvent ( ) end -- Remember last message last_msg[source] = message end ) If the problem is spam then you might consider to protect the other chat's too since those may be accessed by command as well, cancel the event if the same message is sen't twice is one way, a timer would also work.
-
I assume that the animation you thought of is when he holds his hands out like if he where carrying something, in that case you can use bone_attach to attach an item to his arm which will look like he's carrying it.
-
You have two indexes to access each single value in that table, first one is the number within [ and ] and secondly you have the comma separated list of values: Tabla_Marcadores[1][1] -- Returns the following value: 2893 Tabla_Marcadores[2][4] -- Returns the following value: "cylinder" #Tabla_Marcadores -- returns the number of rows (2) #Tabla_Marcadores[1] -- returns the number of columns in row 1 math.random(#Tabla_Marcadores) -- a random index from 1 to the length of your table. Beside this it seems like your table has syntax errors. Try change it into this: local Tabla_Marcadores = { [1]={2893,-911,10,"cylinder",5,255,150,0,255}, [2]={2993,-911,10,"cylinder",5,255,150,0,255}, [3]={2793,-911,10,"cylinder",5,255,150,0,255}, [4]={2693,-911,10,"cylinder",5,255,150,0,255} } And apply the above methods to access the values in it.
-
You can download MTA SA again or just remove the file and let the server generate a new one for you. But in the future you should make a backup since the new "generated" files wastes bandwidth while being downloaded again.
-
You can create it manually by using: triggerEvent. That would look something like this: account addAccount ( string name, string pass ) triggerEvent ( "onAccountCreate", root ) This however, is only useful if you planning to do anything in another resource during account creation, otherwise do as JR10 said.
-
Everything is possible but the solution might not look so nice, one way is to create multiple markers and let them be in different dimensions, not recommended thought, another way is to move the existing marker to the dimension(s) you want it to be visible in. It's all about what your final goal with this is.
-
No matter what, as soon your value goes above 6 that function will just return an error: addEventHandler("onPlayerWasted", root, function(_,killer) if getElementType(killer) == "player" then if getPlayerWantedLevel(killer) < 6 then setPlayerWantedLevel(killer,getPlayerWantedLevel(killer) + 1) else setPlayerWantedLevel(killer,6) end end end ) Always remember to check if it's possible to go one step further. Another solution could be to store the actual wanted level as element data and then just use the stars as a visual effect.
-
Try the "gearbox" in this one: https://community.multitheftauto.com/index.php?p=resources&s=details&id=8338, setVehicleHandling is also an good option with the property "maxVelocity".
-
the source of that event is the element that was clicked which can be compared to any other element for example a button. Converting an element to a string like in the sample will just output it's memory address which isn't needed in your case, especially not since those values will change every time the resource or the server restarts or if the element is removed and then created again.
-
You have too many 'end' at the end, that's what trigger that. Use indentation next time so you can see how many ends you should have. See below example. function sampleIndent() if random1 == random2 then -- Do stuff end end
-
Updated description with an installation guide since getGroupTurfColor seems to be a missing function in the group system by default. That needs to be added manually to make it work with this turf system.
-
Addition to this: Only use that in the end of your file and absolutely not in your server files, only client files. Considering that it's a good way to protect your files, only client files are downloaded.
-
Well that's another thing then, not sure if that's possible but there are some ways to modify the weapon properties using this function: setWeaponProperty, but it won't be easy if it's even possible to do.
-
xXMADEXx is right, programming and scripting is not written like regular math. Only 1 parameter on the left side of "=". And all variables must have a value assigned, unsigned variables will have nil which isn't a value, it's just empty space and can't be used in arithmetic operations but in this case we can't know, if that's an error too then it will appear after this first issue is resolved, outputting something similar to: "Attempt to perform an arithmetic on a nil value".
-
What counter? You mean the time between each "throw"? If that's what you mean you may create a cooldowntimer: cooldown = setTimer(function() end, 3000, 1) -- Timer object which will exist for 3 seconds After that you can check the event onClientWeaponFire and cancel it if the timer exist and the weapon is a molotov using cancelEvent() Weapon id's can be found here. Good luck.
-
In the server lua, I feel stupid now since I can't remember if I added these by myself or if they where included from the beginning, anyway these 2 functions can be used to get turf color and chat color, if they not in the system already it's easy to add. function getGroupChatColor(group) if (not groupTable[group]) then return 255, 255, 255 end local color = fromJSON(groupTable[group][3]) return color[1], color[2], color[3] end function getGroupTurfColor(group) if (not groupTable[group]) then return 255, 255, 255 end local color = fromJSON(groupTable[group][6]) return color[1], color[2], color[3] end And secondly, there is a security bug in the function attemptMakeGroup(), it's explained here: http://mta.albonius.com/index.php?topic=457.0, and a solution is included as well. I recommend you all to see it if you want to prevent special characters from being used to steal existing groups. Remember to backup your database first, and it's already commonly exploited by many players.