-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
First question: local bots = { } local totalZombies = 0 function startnextwave ( wave ) if ( wave == 2 ) then for i = 1, tonumber ( wave * 2 ) do local bot = exports [ "zombies" ]: createZombie ( 0, 0, 0, 0, 140, 0, 0 ) bots [ bot ] = true totalZombies = ( totalZombies + 1 ) outputChatBox ( "chatbox outputs are the zombies." ) end end end addEvent ( "onZombieWasted", true ) addEventHandler ( "onZombieWasted", root, function ( ) if ( bots [ source ] ) then totalZombies = ( totalZombies - 1 ) wave = 1 chekwave ( wave, totalZombies ) outputChatBox ( "zombiekill" ) bots [ source ] = nil end end ) function chekwave ( wave, zombies ) if ( zombies == 0) then wave = ( wave + 1 ) setTimer ( startnextwave, 5000, 1, wave ) end end Try it, though I'm not sure if 'source' from 'onZombieWasted' is the zombie you killed. Second question: That XML is wrong, should be: "23" posy="355" posz="32432" name="lol" /> "3423" posy="3355" posz="3232" name="Test" /> "2433" posy="3545" posz="32" name="Me gusta" /> Then you can loop them all like this: local pathsFile = xmlLoadFile ( "paths.xml" ) if ( pathsFile ) then for index, path in ipairs ( xmlNodeGetChildren ( pathsFile ) ) do local data = xmlNodeGetAttributes ( path ) outputChatBox ( data.name ) end end
-
mainWin = guiCreateWindow(0.80, 0.15, 0.20, 0.60,"WINDOW!!!!!!!!!", true) guiSetVisible ( mianWin, false ) function masiniukui() local car = getPedOccupiedVehicle(getLocalPlayer()) if car then local driver = getVehicleOccupant(car) if driver then if isPedInVehicle(driver) then local carClick = getPedOccupiedVehicle(driver) if carClick then guiSetVisible(mainWin, true) end end end end end addEventHandler("onClientClick", getRootElement(), masiniukui) function cursor( ) if not isCursorShowing() then showCursor(true) else showCursor(false) guiSetVisible(mainWin, false) end end function bind (thePlayer, seat) if source == localPlayer then bindKey( "m", "down", cursor) end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), bind) You was creating the window every time.
-
Because that will be triggered by remote players as well.
-
You should check if the player that entered the vehicle is the localPlayer. if ( source == localPlayer ) then -- Bind key end
-
if showCursor == false then That is wrong, you should use: if ( not isCursorShowing ( ) ) then Or just: showCursor ( not isCursorShowing ( ) ) Would show the cursor if is not already showing, else hide it.
-
addEventHandler ( "onClientVehicleEnter", root, function ( thePlayer, seat ) if ( thePlayer == localPlayer ) then bindKey ( "M", "down", bind ) end end ) That would work.
-
Why didn't work? post what you tried.
-
So, what you want to do is bind a key to trigger that event? function bind ( ) bindKey ( source, "m", "down", trigger ) end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), bind ) function trigger ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then triggerClientEvent ( thePlayer, "bindKey", getRootElement(), "trigger" ) else outputChatBox ( "u need to be in a car", thePlayer ) end end
-
This doesn't really make much sense, why are you binding the key to the same function that binds it? it makes no sense.
-
No creo que haya ninguno como esos en la comunidad, podes buscar igual. https://community.multitheftauto.com/
-
You must make a script to do that, map editor only creates them.
-
setPedAnimation giveWeapon setPedControlState Click on each function name which will redirect you to the MTA wiki where you can learn the syntax.
-
Example: coordinates = { { 0, 0, 0 }, { 0, 0, 5 }, { 0, 0, 10 }, } x, y, z = unpack ( coordinates [ math.random ( #coordinates ) ] )
-
You must make a table with coordinates, then get a random one using: math.random
-
The register system is not built-in, it's part of the admin panel by lil_toady. But the login system it is, though, you can disable that command by restricting it to all in the "acl.xml".
-
Destroy the sound via: destroyElement
-
Maps aren't stored on your hard drive.
-
Is it that hard to go to the link I posted and check the function arguments?
-
"setMoney" function doesn't exist, there is: setPlayerMoney and givePlayerMoney, you should use givePlayerMoney.
-
setElementFrozen is a function, not an event. It works like this: myPed = createPed ( 299, 0, 0, 5 ) setElementFrozen ( myPed, true )
-
Such event does not exist, you must freeze the peds with: setElementFrozen
-
He wants a command to set everyone's vehicle model to the one he choose. addCommandHandler ( "allvehicles", function ( thePlayer, _, model ) local model = tonumber ( model ) if ( model ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do local vehicle = getPedOccupiedVehicle ( player ) if ( vehicle ) then setElementModel ( vehicle, model ) end end end end ) Should work.