Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. 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:
  2. 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 )
  3. pa3ck

    GUI help

    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
  4. pa3ck

    GUI help

    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 )
  5. pa3ck

    GUI help

    Can you show me the whole script?
  6. pa3ck

    GUI help

    Any errors in /debugscript 3?
  7. pa3ck

    GUI help

    I can't understand you. Is it not working, is that what you mean by "I don't see anything"
  8. pa3ck

    GUI help

    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
  9. 'onClientPedWasted' https://wiki.multitheftauto.com/wiki/OnClientPedWasted
  10. pa3ck

    Help me out

    I've seen such thing, so yes, it is.
  11. 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 )
  12. trigger the events with source ( server side ) and localPlayer ( client side ) not with the getRootElement()
  13. Dont you need an 'if' here: local query = #{...}>0 and table.concat({...},' ') or nil
  14. I looked tru your code but I can't figure what's this for: if ( button == "left" ) Did you mean this? : if (source == "nameOfButton")
  15. pa3ck

    about ped

    For shooting you can use a non-mta function / mod called SlothBot. https://forum.multitheftauto.com/viewtopic.php?f=108&t=25488
  16. pa3ck

    won't work

    'onPlayerLogin' is server side and playSound is client side Use the triggerClientEvent from server side to client side.
  17. If you want to use that on server side then trigger a client event and set the gui invisible.
  18. pa3ck

    Userdata value?

    Thanks for the quick help, but is it server side only?
  19. pa3ck

    Userdata value?

    I have a question too. Im not able to give more than 1 word for reason. How could I solve this?
  20. pa3ck

    Userdata value?

    Silly mistakes... Thanks man!
  21. 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?
  22. 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!
  23. 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?
  24. pa3ck

    Help!

    Check this out: viewtopic.php?f=91&t=55525
×
×
  • Create New...