#Paper Posted April 14, 2011 Share Posted April 14, 2011 How i can use this function in clientside? Link to comment
Castillo Posted April 14, 2011 Share Posted April 14, 2011 You can't, maybe you could do some trick to trigger it from server to client anyway Link to comment
Kenix Posted April 15, 2011 Share Posted April 15, 2011 How i can use this function in clientside? You can use the so: Example: local resourceName = getResourceName ( resource ) useGunsInSavePlace = get(resourceName..".UseGunsInSaveZone") meta <setting name="#UseGunsInSaveZone" value="[ false ]" /> and https://wiki.multitheftauto.com/wiki/Get Link to comment
DakiLLa Posted April 15, 2011 Share Posted April 15, 2011 How i can use this function in clientside? You can use the so: Example: local resourceName = getResourceName ( resource ) useGunsInSavePlace = get(resourceName..".UseGunsInSaveZone") meta <setting name="#UseGunsInSaveZone" value="[ false ]" /> and https://wiki.multitheftauto.com/wiki/Get He asks if he could use this function CLIENT SIDE. Link to comment
AGENT_STEELMEAT Posted April 15, 2011 Share Posted April 15, 2011 UNTESTED, but: --client --'theSetting' is the name of the setting you want to retrieve (as a string) function clientGet(theSetting) triggerServerEvent("onClientRequestSettings", getLocalPlayer(), theSetting) end --server function sendSettings(theSetting) value = get(theSetting) if value then triggerClientEvent(source, "receiveSettings", source, value) else triggerClientEvent(source, "receiveSettings", source, false) end addEventHandler("onClientRequestSettings", getRootElement(), sendSettings) --the client requests the setting, then the server sends it back, but it needs a place to go. thats up to you. Link to comment
#Paper Posted April 15, 2011 Author Share Posted April 15, 2011 UNTESTED, but: --client --'theSetting' is the name of the setting you want to retrieve (as a string) function clientGet(theSetting) triggerServerEvent("onClientRequestSettings", getLocalPlayer(), theSetting) end --server function sendSettings(theSetting) value = get(theSetting) if value then triggerClientEvent(source, "receiveSettings", source, value) else triggerClientEvent(source, "receiveSettings", source, false) end addEventHandler("onClientRequestSettings", getRootElement(), sendSettings) --the client requests the setting, then the server sends it back, but it needs a place to go. thats up to you. Thanks I'm not in my pc, but when i am i'll test it ;D Link to comment
AGENT_STEELMEAT Posted April 15, 2011 Share Posted April 15, 2011 It's not going to do anything, thats just a basic way to request the settings. You need to adapt it for your needs. Link to comment
#Paper Posted April 15, 2011 Author Share Posted April 15, 2011 I did adapt it for my needs, but it gives some errors: -----SERVER SIDE addEvent("onClientRequestSettings", true) function sendSettings() local discoPrice = tonumber(clientGet("discoPrice")) local joinmsgPrice = tonumber(clientGet("joinmsgPrice")) local ghostPrice = tonumber(clientGet("ghostPrice")) local ghostDuration = tonumber(clientGet("ghostDuration")) * 1000 local wavesPrice = tonumber(clientGet("wavesPrice")) local fixPrice = tonumber(clientGet("fixPrice")) local flipPrice = tonumber(clientGet("flipPrice")) local nitroPrice = tonumber(clientGet("nitroPrice")) triggerClientEvent(source, "receiveSettings", discoPrice, joinmsgPrice, ghostPrice, ghostDuration, wavesPrice, fixPrice, flipPrice, nitroPrice) end addEventHandler("onClientRequestSettings", getRootElement(), sendSettings) -----CLIENT SIDE function clientGet() triggerServerEvent("onClientRequestSettings", getLocalPlayer()) end addEvent("receiveSettings", true) function setsValues(disco, join, ghostP, ghostDur, wave, fix, flip, nitro) local discoPrice = disco local joinmsgPrice = join local ghostPrice = ghostP local ghostDuration = ghostDur local wavesPrice = wave local fixPrice = fix local flipPrice = flip local nitroPrice = nitro end addEventHandler("receiveSettings", getRootElement(), sendSettings) Link to comment
Moderators Citizen Posted April 15, 2011 Moderators Share Posted April 15, 2011 Because clientGet function doesn't exist Link to comment
#Paper Posted April 16, 2011 Author Share Posted April 16, 2011 Because clientGet function doesn't exist it's defined in the CS... Link to comment
Kenix Posted April 16, 2011 Share Posted April 16, 2011 How i can use this function in clientside? You can use the so: Example: local resourceName = getResourceName ( resource ) useGunsInSavePlace = get(resourceName..".UseGunsInSaveZone") meta <setting name="#UseGunsInSaveZone" value="[ false ]" /> and https://wiki.multitheftauto.com/wiki/Get He asks if he could use this function CLIENT SIDE. I have not noticed that he was referring to the client side Link to comment
Castillo Posted April 16, 2011 Share Posted April 16, 2011 Dude, what's the point of asking for a function that is only server-side to work on client-side and then use it on server-side?, you are using 'clientGet' on server side part. Link to comment
#Paper Posted April 16, 2011 Author Share Posted April 16, 2011 Dude, what's the point of asking for a function that is only server-side to work on client-side and then use it on server-side?, you are using 'clientGet' on server side part. I need to get the settings from the resource in client side... then i use the clientGet func in CS... Link to comment
Castillo Posted April 16, 2011 Share Posted April 16, 2011 You are using his code wrongly, that's all. Link to comment
Timic Posted April 16, 2011 Share Posted April 16, 2011 And this code is from SHCstats Link to comment
#Paper Posted April 16, 2011 Author Share Posted April 16, 2011 And this code is from SHCstats Sniper gave me the permission to use and modifi it Now i'm working to make an userpanel, and i need this func for the shop 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