Jump to content

Coords


External

Recommended Posts

Hi,

I've made a mystery bag script still under progress. I made 3 text boxes for position but the server script doesn't determine which one is the x, y, z

Client:

addEvent("Coords", true)
function Coords(x, y, z)
		if not isElement(_bag) then
	_bag = createPickup(x+2, y+2, z, 3, 1210)
    Blip = createBlipAttachedTo(_bag, 37)
    bagx, bagy, bagz = getElementPosition(_bag)
    areaB = getZoneName(bagx, bagy, bagz)
    cityB = getZoneName(bagx, bagy, bagz, true)
    outputChatBox("A Mystery Bag has appeared at "..areaB..", "..cityB..", go and get it!", getRootElement(), 0, 255, 0)
else
	outputChatBox("There is already a bag in progress", client, 255, 0, 0)
   end
end
addEventHandler("Coords", resourceRoot, Coords)

Server:

       elseif GUIEditor.edit[3] and GUIEditor.edit[2] and GUIEditor.edit[1] ~= "" or " " then
        --[[
    local x = guiGetText(GUIEditor.edit[3])
    local y = guiGetText(GUIEditor.edit[2])
    local z = guiGetText(GUIEditor.edit[1])
    _bag = createPickup(x+2, y+2, z, 3, 1210)
    Blip = createBlipAttachedTo(_bag, 37)
    bagx, bagy, bagz = getElementPosition(_bag)
    areaB = getZoneName(bagx, bagy, bagz)
    cityB = getZoneName(bagx, bagy, bagz, true)
    outputChatBox("A Mystery Bag has appeared at "..areaB..", "..cityB..", go and get it!", 0, 255, 0)
    --]] -- For local Player only
    triggerServerEvent( "Coords", getRootElement(), guiGetText(GUIEditor.edit[3]), guiGetText(GUIEditor.edit[2]), guiGetText(GUIEditor.edit[1]) )
       end
   end
end

 

Link to comment
10 hours ago, Best-Killer said:

Syntax
bool triggerServerEvent ( string event, element theElement, [arguments...] ) 

----------

triggerServerEvent( "Coords", getRootElement(),localPlayer, guiGetText(GUIEditor.edit[3]), guiGetText(GUIEditor.edit[2]), guiGetText(GUIEditor.edit[1]) )

 

Not Working

Link to comment
14 hours ago, Best-Killer said:

Syntax
bool triggerServerEvent ( string event, element theElement, [arguments...] ) 

----------

triggerServerEvent( "Coords", getRootElement(),localPlayer, guiGetText(GUIEditor.edit[3]), guiGetText(GUIEditor.edit[2]), guiGetText(GUIEditor.edit[1]) )

 

That's wrong, getRootElement() is already the sendTo argument, no need for localPlayer (unless if you want it to pass as argument, which is pointless because you have the client variable already)

 

What is wrong exactly with your code?

Edited by pa3ck
Link to comment

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