Spider Pork Posted June 6, 2010 Share Posted June 6, 2010 Hey there! My problem now is that an event doesn't trigger when it should. I used this for triggering: triggerClientEvent("sendChatMessage", source, "Hello there.") And I have added the event client-side: function sendChatMessage(text) local ptext = guiGetText(chatLabel) guiSetText(chatLabel, "" .. ptext .. "\n" .. text .. "") end addEvent("sendChatMessage", true) addEventHandler("sendChatMessage", getRootElement(), sendChatMessage) Though, suprisingly, the same event DOES trigger when I call it from the same server-side script, this one: triggerClientEvent("sendChatMessage", playerid, "You have been successfully registered and logged in.") I am guessing it is the two different player variables. One of them is source and the other one is playerid. I forward playerid from getLocalPlayer in another client-side script. What's wrong? Link to comment
50p Posted June 6, 2010 Share Posted June 6, 2010 Show some more code where the triggerClientEvent is located. What event triggers a function that triggers the client event? Link to comment
dzek (varez) Posted June 6, 2010 Share Posted June 6, 2010 tried with "debugscript 3" in ingame console? Link to comment
Callum Posted June 7, 2010 Share Posted June 7, 2010 triggerClientEvent("sendChatMessage", source, "Hello there.") So if that doesn't work, and yet the other version of it does, the only explination is that the theElement argument is not correct. P.S: If there is no argument before the event name, the event will be triggered for all players. 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