fairyoggy Posted April 23, 2019 Share Posted April 23, 2019 Hello! Can you help me? How can I hide(or stop) the script for only one player? Example: the player connect in server and he does not see the necessary script but when player press the button "login" this script will be displayed or start (if can't just hide) or how i can hide or stop script for players who are in a group (guest) if isGuestAccount(getPlayerAccount(player)) then ... How? Link to comment
Scripting Moderators ds1-e Posted April 23, 2019 Scripting Moderators Share Posted April 23, 2019 20 minutes ago, slapz0r said: Hello! Can you help me? How can I hide(or stop) the script for only one player? Example: the player connect in server and he does not see the necessary script but when player press the button "login" this script will be displayed or start (if can't just hide) or how i can hide or stop script for players who are in a group (guest) if isGuestAccount(getPlayerAccount(player)) then ... How? If you are about not downloading them for players you can use: <script src="script.lua" type="client" cache="false"/> In meta.xml 1 Link to comment
fairyoggy Posted April 23, 2019 Author Share Posted April 23, 2019 (edited) 57 minutes ago, majqq said: If you are about not downloading them for players you can use: <script src="script.lua" type="client" cache="false"/> In meta.xml I mean these resources are necessary, but hide or dont start for players who not login. and when they login this resource will be started or unhide Edited April 23, 2019 by slapz0r Link to comment
Scripting Moderators ds1-e Posted April 24, 2019 Scripting Moderators Share Posted April 24, 2019 7 hours ago, slapz0r said: I mean these resources are necessary, but hide or dont start for players who not login. and when they login this resource will be started or unhide Clientside scripts which have cache="false" will be not saved in player cache, but in RAM. So, still you can use them. I don't really understand you, can you be a more specific? You need to hide scripts/files or something else? 1 Link to comment
Sendy Posted April 24, 2019 Share Posted April 24, 2019 (edited) onPlayerLogin triggerClientEvent downloadFile Edited April 24, 2019 by Sendy Link to comment
nxFairlywell Posted April 24, 2019 Share Posted April 24, 2019 59 minutes ago, Sendy said: onPlayerLogin triggerClientEvent downloadFile Or, you can put your code inside a new function and export it when you want to enable it . 1 Link to comment
fairyoggy Posted April 24, 2019 Author Share Posted April 24, 2019 (edited) 12 hours ago, majqq said: Clientside scripts which have cache="false" will be not saved in player cache, but in RAM. So, still you can use them. I don't really understand you, can you be a more specific? You need to hide scripts/files or something else? Sorry for my bad english. I have 2 custom scripts (hud, radar). So if player join on server he sees these scripts (hud, radar) but that's not what i need. setPlayerHudComponentVisible( source, "all", false ) didn't work for that. I think because it's custom scripts. So I need to hide these 2 scripts for "onPlayerJoin" and when player "onPlayerLogin" this scripts will be start. So if i try to use cache off and after "onPlayerLogin" this scripts will be download or start. These actions will help me? Edited April 24, 2019 by slapz0r Link to comment
fairyoggy Posted April 25, 2019 Author Share Posted April 25, 2019 UP. it's didn't work because in meta.xml cache = false and scripts work Link to comment
nxFairlywell Posted April 25, 2019 Share Posted April 25, 2019 (edited) 18 hours ago, slapz0r said: Sorry for my bad english. I have 2 custom scripts (hud, radar). So if player join on server he sees these scripts (hud, radar) but that's not what i need. setPlayerHudComponentVisible( source, "all", false ) didn't work for that. I think because it's custom scripts. So I need to hide these 2 scripts for "onPlayerJoin" and when player "onPlayerLogin" this scripts will be start. So if i try to use cache off and after "onPlayerLogin" this scripts will be download or start. These actions will help me? No, they won't help you, i have understood you want to start a custom script when the player has logged in you will type your custom script codes inside a new function like this : outputChatBox("Welcome to server"); -- This function will start when the script has downloaded function out() -- but this function will not . outputChatBox("Welcome to server"); end and the script name will be : mycustomhud and file name will be : hud.lua so what do you need to do ? you need to put the function inside your meta.xml file like this : <meta> <script src="hud.lua" type="client" /> <export function="out" type="client"/> </meta> Then you will export the function to your login script, let us type a new code : addEventHandler("onPlayerLogin",root, function() triggerClientEvent("onClientLogin",source); end ); -- Client addEvent("onClientLogin",true); function onClientLogin() --So , now you will type the export code to get a message .. exports["mycustomhud"]:out(); -- This will output a chat message -- exports -- is export function -- mycustomhud -- is the name of your custom hud script -- out() is the function of the message in hud.lua file end addEventHandler("onClientLogin",root,onClientLogin); They were just examples. You can follow the steps and apply their in your scripts. Edited April 25, 2019 by NX_CI 1 Link to comment
fairyoggy Posted April 26, 2019 Author Share Posted April 26, 2019 16 hours ago, NX_CI said: No, they won't help you, i have understood you want to start a custom script when the player has logged in you will type your custom script codes inside a new function like this : outputChatBox("Welcome to server"); -- This function will start when the script has downloaded function out() -- but this function will not . outputChatBox("Welcome to server"); end and the script name will be : mycustomhud and file name will be : hud.lua so what do you need to do ? you need to put the function inside your meta.xml file like this : <meta> <script src="hud.lua" type="client" /> <export function="out" type="client"/> </meta> Then you will export the function to your login script, let us type a new code : addEventHandler("onPlayerLogin",root, function() triggerClientEvent("onClientLogin",source); end ); -- Client addEvent("onClientLogin",true); function onClientLogin() --So , now you will type the export code to get a message .. exports["mycustomhud"]:out(); -- This will output a chat message -- exports -- is export function -- mycustomhud -- is the name of your custom hud script -- out() is the function of the message in hud.lua file end addEventHandler("onClientLogin",root,onClientLogin); They were just examples. You can follow the steps and apply their in your scripts. Your example not working(or i dont undestand), I tried to just make your example and nothing comes out. get out various errors( 1. call:failed to call "mycustomhud:out" [string "?"] 2. [server] OnClientLogin is deprecated and may not work in future versions. Can you create working script like this example? When player login a message appears in the chat. Link to comment
nxFairlywell Posted April 26, 2019 Share Posted April 26, 2019 It's working bro. hidescript.zip 1 Link to comment
fairyoggy Posted April 26, 2019 Author Share Posted April 26, 2019 1 hour ago, NX_CI said: It's working bro. hidescript.zip ye, now it's work. I will try to work with these examples to solve my problems. Can I have another question? I would like to bind key to open a chat, I mean when a player presses a button "T" appears text line How can I do the same thing on another button? Link to comment
nxFairlywell Posted April 26, 2019 Share Posted April 26, 2019 (edited) 12 minutes ago, slapz0r said: ye, now it's work. I will try to work with these examples to solve my problems. Can I have another question? I would like to bind key to open a chat, I mean when a player presses a button "T" appears text line How can I do the same thing on another button? You should create a new custom chatbox, i don't know is there another way or not. but, for stay away from wrongs you will create a custom chatbox. Edited April 26, 2019 by NX_CI Link to comment
fairyoggy Posted April 26, 2019 Author Share Posted April 26, 2019 2 minutes ago, NX_CI said: You must create a new custom chatbox, i don't know is there another way or not. but, for stay away from wrongs you will create a custom chatbox. so i can't use standard chatbox? just bind another key. I don't need to delete the old button.I just need to add another button to call the chat. Link to comment
nxFairlywell Posted April 26, 2019 Share Posted April 26, 2019 bindKey("Y","up", function() setControlState (localPlayer,"chatbox",true); end ) Link to comment
fairyoggy Posted April 26, 2019 Author Share Posted April 26, 2019 6 minutes ago, NX_CI said: bindKey("Y","up", function() setControlState (localPlayer,"chatbox",true); end ) dont work and warning in console about deprecated Link to comment
nxFairlywell Posted April 26, 2019 Share Posted April 26, 2019 27 minutes ago, slapz0r said: dont work and warning in console about deprecated bindKey("L","down","chatbox","say"); 1 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