Jump to content

[HELP]onPlayerWasted


Hero192

Recommended Posts

Posted

Hey guys,

It's a pickup mission, i want if the player wasted the pickup be at his dead location,i tried this way but failed:

  
local locations = { 
    { 1463.80, 2823.78, 10.82}, 
} 
 local pos = locations[math.random(#locations)] 
            local x,y,z = unpack ( pos ) 
             BaseLV = createPickup(x, y, z-1, 3, 1210, 1, 1) 
  
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
    local x, y, z = getElementPosition (  BaseLV [ source ] )  
        local x, y, z = getElementPosition ( source ) 
         BaseLV [ source ] = createPickup ( x, y, z-1, 3, 1210, 1, 1 ) 
    end 
) 
  
  

Posted

Wtf? This doesn't make any sense.

  
local BaseLV = {} 
  
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function() 
        local x, y, z = getElementPosition ( source ) 
        BaseLV [ source ] = createPickup ( x, y, z-1, 3, 1210, 1, 1 ) 
    end 
) 

Posted

Thank you i'll try it out

EDIT: I have another question

i want to know how to make an Captcha, random code i mean

like when you hit a marker you get GUI with an random code, you have to write it in the EditBox when you click ok the gate open, if its false then the gate won't open

2nd question,How to let an button write numbers in editbox, like a keyboard

Posted

2: I don't understand. You want only numbers to appear in editbox?

Imagine you have a GUI with Buttons, each button you name it with a number, 1.2.3.4....etc

And when you click on button with number One, "1" it write a Number in editbox, same for other nums

By the way, i tried to use setElement data from client to server for destroy the blip but doesn't works

--server side:

local  BaseLV = {} 
  
addEventHandler( "onPlayerWasted", getRootElement( ), 
    function () 
    local blp = getElementData(source, "blp") 
    if not blp then return end 
        destroyElement (blp) 
        local x, y, z = getElementPosition ( source ) 
        BaseLV  = createPickup ( x, y, z, 3, 1210, 1, 1 ) 
         
    end 
) 

--client side:

 blp = createBlip(826.1767578125, 853.82403564453,10.948932647705, 51) 
     setElementData(localPlayer,"blp",blp) 

Posted

Just create buttons, once you click on the button (onClientGUIClick), use guiSetText and edit the editbox. Try to do it.

Why don't you use createBlip server side where onPlayerWasted is?

Posted

Because im already using it in client side, it's just a part of blp not full code and if i created it in server side i'll have to use setElementdata again from server side to client..

Posted

From what I see, the blip should be deleted. Debug your code like

getElementType(getElementData(source, "blp")) 

Posted

You understood me by wrong i think, im using it in client side i just need to get the blip from client side to server to destroy it there

--Client-side

client = getLocalPlayer() 
  
function create () 
    local mkr = createMarker(826.1767578125, 853.82403564453,10.948932647705, "cylinder", 2.0, 255,20, 23) 
     blp = createBlip(826.1767578125, 853.82403564453,10.948932647705, 51) 
     setElementData(localPlayer,"blp",blp) 
     addEventHandler("onClientMarkerHit", mkr,  Done) 
end 
addEvent("delivery" , true) 
addEventHandler("delivery ", client, create ) 
  
function  Done(player, matching) 
if (player == localPlayer and matching) then 
  triggerServerEvent(" doneJob", player ) 
  addEventHandler("onClientRender",root,message) 
  destroyElement(source) 
  destroyElement(blp) 
  
   end 
end 
  
  

Posted
addEventHandler("onClientPlayerWasted", localPlayer, function() 
    if isElement(blp) then destroyElement(blp) end 
    if isElement(mkr) then 
     removeEventHandler("onClientMarkerHit",mkr,Done) 
     destroyElement(mkr)  
   end 
end) 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...