SimpleNoob Posted February 8, 2016 Share Posted February 8, 2016 Hello, im doing a system of vip money apart of the default gta's money, but i cant export the functions that i done, for example i want to get the number of money that have the target: function getPVPMoney (target) return getElementData (target,"pvpmoney") end later when i use this function, debugscript throws an error saying that expected element not resource-data Link to comment
Enargy, Posted February 9, 2016 Share Posted February 9, 2016 function getPVPMoney (target) if getElementType(target) ~= "player" then return end return getElementData (target,"pvpmoney") or 0 -- if anyone has not the data it'll return 0. end Link to comment
SimpleNoob Posted February 9, 2016 Author Share Posted February 9, 2016 With that functions returns nil function test(player) local vipmoneys = getPVPMoney(player) outputChatBox("there is "..tostring(pvpmoneys)) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),test) Link to comment
Bonsai Posted February 9, 2016 Share Posted February 9, 2016 https://wiki.multitheftauto.com/wiki/OnResourceStart doesn't have a player parameter. It only provides the resource that started. Also instead of "getResourceRootElement(getThisResource())" you can write "resourceRoot". Link to comment
SimpleNoob Posted February 13, 2016 Author Share Posted February 13, 2016 Hello, thanks very much for the help provided by you, my script is working fine but i have a problem, i exported the functions and i want to put the information on a visible dxDrawText, but the functions are serverside, how can i use it and get the money on a client script? Link to comment
Enargy, Posted February 13, 2016 Share Posted February 13, 2016 Hello, thanks very much for the help provided by you, my script is working fine but i have a problem, i exported the functions and i want to put the information on a visible dxDrawText, but the functions are serverside, how can i use it and get the money on a client script? You must get the element-data and put it at dxDrawText as string. dxDrawText(tostring(getElementData (target,"pvpmoney")) or "0", x ,y ,w, h) Link to comment
SimpleNoob Posted February 13, 2016 Author Share Posted February 13, 2016 oh, i didnt think it that way , thanks very much Link to comment
SimpleNoob Posted February 13, 2016 Author Share Posted February 13, 2016 sorry for the double post, but i tested right now, getELementData is a serverside function Link to comment
SimpleNoob Posted February 13, 2016 Author Share Posted February 13, 2016 but i have this error: and this is the code dxDrawText(""..tostring(getELementData(getLocalPlayer(),"pvpmoney")).."", 1150*sW,530*sH,1150*sW,562*sH,tocolor(0,150,150,255), sH*1, "arial", "center", "center", false, false, true,false,false) where is the problem then? Link to comment
Dimos7 Posted February 13, 2016 Share Posted February 13, 2016 dxDrawText(""..tostring(getElementData(getLocalPlayer(),"pvpmoney")).."", 1150*sW,530*sH,1150*sW,562*sH,tocolor(0,150,150,255), sH*1, "arial", "center", "center", false, false, true,false,false) Link to comment
Simple0x47 Posted February 13, 2016 Share Posted February 13, 2016 I think this is the problem (I cannot see the problem picture) getELementData convert that to getElementData . And thank for telling me that I'm a noob :v Link to comment
SimpleNoob Posted February 13, 2016 Author Share Posted February 13, 2016 , yes, that was the problem, i didnt see that , sorry for that 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