Gallagher Posted February 1, 2014 Share Posted February 1, 2014 I have this client-side script. I want to put a function or server-side event to qo script only works if the file server side "server.lua" ----Client ----- function createText1 ( ) clip = getPedAmmoInClip ( getLocalPlayer() ) arma = getPedWeapon( getLocalPlayer() ) dxDrawText(""..clip.." | "..bala,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) if ( arma==34 ) then dxDrawText(" DMR ",screenWidth*0.77, screenHeight*0.02012, screenWidth*0.0, screenHeight*0.0, tocolor(50, 200, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) elseif ( arma==31 ) then dxDrawText(" M4A1 ",screenWidth*0.77, screenHeight*0.02012, screenWidth*0.0, screenHeight*0.0, tocolor(50, 200, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) elseif ( arma==28 ) then dxDrawText(" PWD ",screenWidth*0.80, screenHeight*0.020, screenWidth*0.0, screenHeight*0.0, tocolor(50, 50, 31, 205), 1.05, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(" PWD ",screenWidth*0.8015, screenHeight*0.02012, screenWidth*0.0, screenHeight*0.0, tocolor(50, 200, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) elseif ( arma==33 ) then dxDrawText(" winchester ",screenWidth*0.1, screenHeight*0.6, screenWidth*0.0, screenHeight*0.0, tocolor(203, 112, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createText1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) Link to comment
Castillo Posted February 1, 2014 Share Posted February 1, 2014 I don't understand what do you mean, please explain yourself. Link to comment
Gallagher Posted February 1, 2014 Author Share Posted February 1, 2014 I don't understand what do you mean, please explain yourself. I want the client script to work if I have the server side also. because as my client-side script is a thief can get into my server and steal it even if it is compiled Link to comment
Castillo Posted February 1, 2014 Share Posted February 1, 2014 That's not a really secure way to do it, since they can also add the server side event to do whatever it has to do. Link to comment
Gallagher Posted February 1, 2014 Author Share Posted February 1, 2014 That's not a really secure way to do it, since they can also add the server side event to do whatever it has to do. but if cliente.lua is compiled has no way of knowing what the event Link to comment
MTA Team 0xCiBeR Posted February 1, 2014 MTA Team Share Posted February 1, 2014 Then just trigger the event client side and check if it was succesfull, if it's not, then end the function there. Link to comment
Gallagher Posted February 1, 2014 Author Share Posted February 1, 2014 Then just trigger the event client side and check if it was succesfull, if it's not, then end the function there. Can you give me an example? Link to comment
MTA Team 0xCiBeR Posted February 2, 2014 MTA Team Share Posted February 2, 2014 (edited) Try this: Client: function createText1 ( ) clip = getPedAmmoInClip ( getLocalPlayer() ) arma = getPedWeapon( getLocalPlayer() ) dxDrawText(""..clip.." | "..bala,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) if ( arma==34 ) then dxDrawText(" DMR ",screenWidth*0.77, screenHeight*0.02012, screenWidth*0.0, screenHeight*0.0, tocolor(50, 200, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) elseif ( arma==31 ) then dxDrawText(" M4A1 ",screenWidth*0.77, screenHeight*0.02012, screenWidth*0.0, screenHeight*0.0, tocolor(50, 200, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) elseif ( arma==28 ) then dxDrawText(" PWD ",screenWidth*0.80, screenHeight*0.020, screenWidth*0.0, screenHeight*0.0, tocolor(50, 50, 31, 205), 1.05, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(" PWD ",screenWidth*0.8015, screenHeight*0.02012, screenWidth*0.0, screenHeight*0.0, tocolor(50, 200, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) elseif ( arma==33 ) then dxDrawText(" winchester ",screenWidth*0.1, screenHeight*0.6, screenWidth*0.0, screenHeight*0.0, tocolor(203, 112, 31, 255), 1, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) triggerServerEvent ( "abcdefghijklmnopqrstuvwxyz", localPlayer) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) addEvent("yes",true) function yes(thecode) if thecode == "magicbeans" then addEventHandler ( "onClientRender", root, createText1 ) end end addEventHandler("yes",root,yes) Server: function yeah () triggerClientEvent(source,"yes",source,"magicbeans") end addEvent("abcdefghijklmnopqrstuvwxyz",true) addEventHandler("abcdefghijklmnopqrstuvwxyz",root,yeah) PD: I'm from my cel, don't know if everything is perfect. Edited February 2, 2014 by Guest Link to comment
Castillo Posted February 2, 2014 Share Posted February 2, 2014 That's not a really secure way to do it, since they can also add the server side event to do whatever it has to do. but if cliente.lua is compiled has no way of knowing what the event It does, they execute the script and the debug script will output that it triggered X event and is not added server side. Link to comment
MTA Team 0xCiBeR Posted February 2, 2014 MTA Team Share Posted February 2, 2014 That's true, but you can add a secret code, then they are fried. Link to comment
TAPL Posted February 2, 2014 Share Posted February 2, 2014 You can also set element data at server side when the player join and check the element data client side. ======================================================================== .:CiBeR:. you forget the sendTo argument. triggerClientEvent("yes",source,"magicbeans") Should be: triggerClientEvent(source,"yes",source,"magicbeans") Link to comment
MTA Team 0xCiBeR Posted February 2, 2014 MTA Team Share Posted February 2, 2014 Yeah missed it, i was from my cel thanks Link to comment
ixjf Posted February 2, 2014 Share Posted February 2, 2014 That's true, but you can add a secret code, then they are fried. You can still see function names and strings in compiled Lua code. Link to comment
TAPL Posted February 2, 2014 Share Posted February 2, 2014 That's true, but you can add a secret code, then they are fried. You can still see function names and strings in compiled Lua code. You can't with encrypt, or there is a way i don't know? Link to comment
ixjf Posted February 2, 2014 Share Posted February 2, 2014 Compiled* (because encryption is not compilation, unless you are talking about the encryption method that MTA recently implemented) Lua code, yes, it's as simple as opening the file with any text editor. 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