Gallagher Posted January 15, 2014 Share Posted January 15, 2014 I made a script on the client side and would not want someone to steal, how do I get it to the server side? Or he needs something from the server side to work? thank you! 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 HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) Link to comment
pa3ck Posted January 15, 2014 Share Posted January 15, 2014 Compile your script, then they can't steal it easily. GUI, DX and stuff like that are all client-side only functions, can not be done server-side. Link to comment
Gallardo9944 Posted January 15, 2014 Share Posted January 15, 2014 you can also send a string with your code and do a loadstring + pcall clientside. Link to comment
Gallagher Posted January 15, 2014 Author Share Posted January 15, 2014 you can also send a string with your code and do a loadstring + pcall clientside. how to do it? Link to comment
Gallardo9944 Posted January 15, 2014 Share Posted January 15, 2014 Should be working. Didn't test though. -- SERVERSIDE local text = [[ -- Double bracket is made to have an ability to write multiple lines in lua string. Don't need if you have the text in a variable. outputChatBox("Here it goes") outputChatBox("And here too") ]] -- your code function triggerIt(player) triggerClientEvent(player,"launchCode",player,text) -- trigger to clientside end addCommandHandler("launch",triggerIt) -- it will happen when you write /launch -- CLIENTSIDE addEvent("launchCode",true) function launchCode(code) local compiledCode = loadstring(code) -- compile the code local handler = pcall(compiledCode) -- load the code if handler then outputChatBox("It loaded, yeah") else outputChatBox(":(") end end addEventHandler("launchCode",getRootElement(),launchCode) Link to comment
Gallagher Posted January 15, 2014 Author Share Posted January 15, 2014 Should be working. Didn't test though. -- SERVERSIDE local text = [[ -- Double bracket is made to have an ability to write multiple lines in lua string. Don't need if you have the text in a variable. outputChatBox("Here it goes") outputChatBox("And here too") ]] -- your code function triggerIt(player) triggerClientEvent(player,"launchCode",player,text) -- trigger to clientside end addCommandHandler("launch",triggerIt) -- it will happen when you write /launch -- CLIENTSIDE addEvent("launchCode",true) function launchCode(code) local compiledCode = loadstring(code) -- compile the code local handler = pcall(compiledCode) -- load the code if handler then outputChatBox("It loaded, yeah") else outputChatBox(":(") end end addEventHandler("launchCode",getRootElement(),launchCode) I will test 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