Karuzo Posted January 25, 2014 Share Posted January 25, 2014 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
DiSaMe Posted January 25, 2014 Share Posted January 25, 2014 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
Karuzo Posted January 25, 2014 Author Share Posted January 25, 2014 Oh sorry forgot that completely. Well , the problem is that the Skin doesn't change, the Player doesn't receive the Deagle, and he isn't teleported to the given Position. Link to comment
Karuzo Posted January 25, 2014 Author Share Posted January 25, 2014 So, no-one can help me ? Link to comment
Castillo Posted January 25, 2014 Share Posted January 25, 2014 triggerServerEvent("Polis", getLocalPlayer() ) Change it to: triggerServerEvent ( "Polis", localPlayer, localPlayer ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now