iLimix Posted August 11, 2017 Share Posted August 11, 2017 Hey guys, i don't know what it can be function KDShow(player) dxDrawText(getElementData ( localPlayer, "deaths" ), 86, 367, 193, 388, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end Expected string at argument 1, got boolean i hope u can help me. Link to comment
Rockyz Posted August 11, 2017 Share Posted August 11, 2017 try this : function KDShow(player) dxDrawText(getElementData ( localPlayer, "deaths" ) and tostring ( getElementData ( localPlayer, "deaths" ) ) or "N/A", 86, 367, 193, 388, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end Link to comment
Mr.Loki Posted August 11, 2017 Share Posted August 11, 2017 The problem is that the there is no data for "deaths" on the player so it is returning a boolean( a true/false value ) which would be false in your case. function KDShow(player) local deaths = getElementData ( localPlayer, "deaths" ) dxDrawText(deaths or 0, 86, 367, 193, 388, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end What I've done is made a simple check to see if deaths == false. If deaths == false it will use the or operator and return 0. If deaths == a number or anything, it will show that value of "deaths" instead. local deaths = (getElementData ( localPlayer, "deaths" ) or 0) Link to comment
iLimix Posted August 11, 2017 Author Share Posted August 11, 2017 12 minutes ago, Mr.Loki said: The problem is that the there is no data for "deaths" on the player so it is returning a boolean( a true/false value ) which would be false in your case. function KDShow(player) local deaths = getElementData ( localPlayer, "deaths" ) dxDrawText(deaths or 0, 86, 367, 193, 388, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end What I've done is made a simple check to see if deaths == false. If deaths == false it will use the or operator and return 0. If deaths == a number or anything, it will show that value of "deaths" instead. local deaths = (getElementData ( localPlayer, "deaths" ) or 0) He show me now "0" but in Database show me 45 Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 Database is not your elementdata, whenever you log in, you have to set the player's elementdata to the one which he has in the database. Link to comment
iLimix Posted August 11, 2017 Author Share Posted August 11, 2017 setElementData ( player, "deaths", tonumber ( dsatz["Tode"] ) ) setElementData ( player, "kills", tonumber ( dsatz["Kills"] ) ) this is in Register / Login script Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 Try to debug it. Output the number when you log in. Link to comment
iLimix Posted August 11, 2017 Author Share Posted August 11, 2017 (edited) 59 minutes ago, NeXuS™ said: Try to debug it. Output the number when you log in. Serverside its work: outputChatBox ( "Tode: "..getElementData ( player, "Tode"),client,255,255,255) But not in Clientside dxDrawText( getElementData(lp,"Tode") Edited August 11, 2017 by iLimix Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 Is "lp" defined as localplayer? Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 outputChatBox(tostring(isElement(lp)) .. " " .. tostring(lp == localPlayer)) outputChatBox(getElementData(lp,"Tode")) Try this. Link to comment
iLimix Posted August 11, 2017 Author Share Posted August 11, 2017 i Become spam true true and Warning outputChatBox(getElementData(lp,"Tode")) string 1 got boolean 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