Jump to content

triggering errors.


Karuzo

Recommended Posts

Hey Guys,

so i have a problem with triggering from the client to the server...

Client:

function Polis1() 
    triggerServerEvent("Polis",  getLocalPlayer() ) 
    outputChatBox("Polis meslegine hosgeldin  " ..nameplay.."  ! Gangsterleri öldürmeye calisican!", 0, 255, 0, false) 
    guiSetVisible(Meslekwindow, false) 
    showCursor(false) 
end 

Server:

function Polis1(thePlayer) 
    if (getPlayerSkin(thePlayer) == 281) then 
    outputChatBox("Polissin zaaten!!", thePlayer) 
  else 
    setPlayerSkin(thePlayer, 281) 
    outputChatBox("Deagle verildin!.", thePlayer) 
    setElementPosition(thePlayer, 1589, -1625, 14) 
    giveWeapon(thePlayer, 24, 150, true) 
    triggerClientEvent("DXPOLIS", client) -- this is ok. 
  end 
end 
addEvent("Polis" , true) 
addEventHandler("Polis", root, Polis1) 

Link to comment

You didn't say what the problem is, but it seems like you use the arguments incorrectly. 2nd argument of triggerServerEvent is the source of the event, and function arguments come after it.

--client 
triggerServerEvent("someEvent", someElement, "aaaa", "bbbb") 
  
--server 
function handlerOfSomeEvent(arg1, arg2) 
    -- 'source' is the same as 'someElement' was on the client 
    -- 'arg1' is "aaaa" 
    -- 'arg2' is "bbbb" 
end 

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