iPanda Posted January 18, 2015 Posted January 18, 2015 Hi, Each player has a dx text to the left, which shows the message administrator for every player on the server. Message is the same. How outputChatBox() on the server side. --client local sms = '' addEventHandler('onClientRender',root,function() dxDrawText(sms,5,500,1,1,tocolor(255,255,255,250),1.2,'default-bold','left','top',false,false,false,false,false) end) and when the administrator writes a command to the server, it is displayed to all players in the line dx text. --server addCommandHandler('sms',function(admin,cmd) --my condition if player is admins (no matter) --here I need to equate 'cmd' to 'sms' < end) How do I send a variable to the server side and back? and how to work what I want?
xScatta Posted January 18, 2015 Posted January 18, 2015 Hey ! U can do it by triggering clientside event from server look. --server addCommandHandler("sms",function (player,cmd,sms) -- Command triggerClientEvent("onSMSTrigger",sms) -- Triggering a clientside event which changes the SMS for all clients. end) -- client local sms = " " addEvent("onSMSTrigger",true) -- Making the Event so the server can trigger it. addEventHandler("onSMSTrigger",root,function(newSMS) -- function which changes the text. sms = newSMS -- changing the message end) addEventHandler('onClientRender',root,function() -- Drawing event. dxDrawText(sms,5,500,1,1,tocolor(255,255,255,250),1.2,'default-bold','left','top',false,false,false,false,false) -- drawing the actual message end) It's fine to celebrate success but it is more important to heed the lessons of failure.
TAPL Posted January 19, 2015 Posted January 19, 2015 triggerClientEvent("onSMSTrigger",sms) -- Triggering a clientside event which changes Should be: triggerClientEvent("onSMSTrigger",player, sms) -- Triggering a clientside event which changes And use table.concat to get the words after space.
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