![](https://forum.multitheftauto.com/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
pa3ck
Members-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
7
Everything posted by pa3ck
-
For the player spawn: --client function onClientDied(killer, weapon, bodypart) local thePlayer = getLocalPlayer() triggerServerEvent('onPlayerDied', localPlayer, thePlayer) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), onClientDied) --server addEvent('onPlayerDied', true) addEventHandler('onPlayerDied', getRootElement(), function ( thePlayer ) setTimer(function() spawnPlayer(thePlayer, -2404.66943, -596.81165, 132.64844) end, 5000, 1) end) Set this "-2404.66943, -596.81165, 132.64844" to the position you want them to spawn and the '5000' after it ( again its in milliseconds ) Make sure you have them defined correctly in meta.xml. Like:
-
Image: function showClientImage() local img = guiCreateStaticImage( 0, 500, 59, 58, "image.png", false ) setTimer(function() destroyElement(img) end, 5000, 1) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) Set the 5000 as you need ( its in milliseconds )
-
local playerName = getPlayerName(getLocalPlayer()) For x and y actually you can just sub in the numbers like so: dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) --You had it like this dxDrawRectangle ( posX, posY, sizeX, sizeY, tocolor ( 0, 0, 0, 150 ) ) -- You need it like this Same for the dxDrawText's
-
Okay, than you have to define the following variables: x, y, and playerName as none of them is defined anywhere. ( Also, you SHOULD get errors in debugscript 3 with that code )
-
I can't understand you. Is it not working, is that what you mean by "I don't see anything"
-
You want to set the drawstuff gui invisible, but you have no gui. Solidsnake gave you a function ( removeEventHandler ) and use it like this: function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end addEventHandler('onClientRender', getRootElement(), drawStuff) local seconds = 50 setTimer ( function() removeEventHandler("onClientRender", getRootElement(), drawStuff) end, ( seconds * 100 ), 1 ) OR function drawStuff() dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.5, y/3.6, x, y, tocolor ( 255, 255, 255, 255 ), 1, "bankgothic" ) dxDrawText ( "Welcome to\nLos Santos Roleplay " .. playerName, x/3.48, y/3.58, x, y, tocolor ( 0, 0, 0, 255 ), 1, "bankgothic" ) end addEventHandler('onClientRender', getRootElement(), drawStuff) function closedrawstuff() removeEventHandler("onClientRender", getRootElement(), drawStuff) end local seconds = 50 setTimer ( closedrawstuff, ( seconds * 100 ), 1 ) They're the same thing, but the second one is easier
-
'onClientPedWasted' https://wiki.multitheftauto.com/wiki/OnClientPedWasted
-
I've seen such thing, so yes, it is.
-
triggerClientEvent is different. ( bool triggerClientEvent ( [element sendTo=getRootElement()], string name, element theElement, [arguments...] ) ) https://wiki.multitheftauto.com/wiki/TriggerClientEvent Try this: triggerClientEvent ( source, "onMavStopShootC", source )
-
trigger the events with source ( server side ) and localPlayer ( client side ) not with the getRootElement()
-
Dont you need an 'if' here: local query = #{...}>0 and table.concat({...},' ') or nil
-
I looked tru your code but I can't figure what's this for: if ( button == "left" ) Did you mean this? : if (source == "nameOfButton")
-
For shooting you can use a non-mta function / mod called SlothBot. https://forum.multitheftauto.com/viewtopic.php?f=108&t=25488
-
'onPlayerLogin' is server side and playSound is client side Use the triggerClientEvent from server side to client side.
-
If you want to use that on server side then trigger a client event and set the gui invisible.
-
Thanks for the quick help, but is it server side only?
-
I have a question too. Im not able to give more than 1 word for reason. How could I solve this?
-
Oh hello there, I got some problem with this little code I wrote. function jail(cmd, who, jailtimet, reason) local whom = getPlayerFromName(who) local jailtime = tonumber(jailtimet) function release() setElementInterior(whom, 0) setElementPosition(whom, 1552.95630, -1675.40747, 16.1953) end if whom then if jailtime then if reason then local theadmin = getPlayerName(getLocalPlayer()) setElementInterior(whom, 6) setElementPosition(whom, 264.19745, 77.76832, 1001.03906) setTimer(release, jailtime * 1000, 1) outputChatBox('Successfully jailed ' .. whom .. ' for ' .. jailtime .. ' sec. Reason: ' ..reason, 0, 255, 0) triggerServerEvent('jailed', getRootElement(), jailtime, reason, whom, theadmin) else outputChatBox('Reason?') end else outputChatBox('Jail time?') end else outputChatBox('Who?') end end addCommandHandler('jail', jail) The problem is, that for variable 'whom' I get a userdata value... Its something like 00000006F. Why is that?
-
I'm such a noob! Thanks a mill man! It's not the first time you helped me ( would not bet if it was the last tho ), I really appreciate it!
-
Good evening folks, I found a problem / bug in my script which is the following: If I'm using the function alone, its working well, no problem, but if 2 clients use it at the same time then it will get buggy. Sometimes it wont switch on sometimes its just blinks... Here is the code I was using: --Client function lights() local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then triggerServerEvent('lightS', getRootElement(), veh) end end addEventHandler('onClientVehicleEnter',getRootElement(),function() bindKey( 'l', 'down', lights ) end ) --Server addEvent('lightS', true) addEventHandler('lightS', root, function( veh ) if ( getVehicleOverrideLights(veh) ~= 2 ) then setVehicleOverrideLights(veh, 2) elseif ( getVehicleOverrideLights(veh) == 2) then setVehicleOverrideLights(veh, 1) end end ) Any idea / solutions?