Spider Pork Posted June 6, 2010 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?
50p Posted June 6, 2010 Posted June 6, 2010 Show some more code where the triggerClientEvent is located. What event triggers a function that triggers the client event? - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
dzek (varez) Posted June 6, 2010 Posted June 6, 2010 tried with "debugscript 3" in ingame console? Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Callum Posted June 7, 2010 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. Retired
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