-
Posts
208 -
Joined
-
Last visited
Everything posted by Newbie
-
function DestructionWin( ) local alivePlayers = getAlivePlayers( ) if #alivePlayers == 1 then local account = getPlayerAccount( alivePlayers[1] ) if account then if isGuestAccount( account ) then return end setAccountData( account,"Wins",tostring( getAccountData( account,"Wins" ) or 0 )+1 ) setAccountData( account,"Cash",tostring( getAccountData( account,"Cash" ) or 0 )+ 250 ) setAccountData( account,"EXP",tostring( getAccountData( account,"EXP" ) or 0 )+math.random(2,3) ) outputChatBox("#FF0000={#FFFFFFWin#FF0000}= #FFFFFFYou have earned #FF0000250 #FFFFFF$ and some EXP!", source, 255, 255, 255, true) end end end
-
Thanks : ))
-
Thanks for your help Solidsnake! I did like this: function statss() if isElement( source ) then local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local account = getPlayerAccount( source ) local win = tonumber(getAccountData(account, "Wins")) or 0 local dead = tonumber(getAccountData(account, "Deaths")) or 0 local tim = tonumber(getAccountData(account, "Time")) or 0 local hunt = tonumber(getAccountData(account, "Hunters")) or 0 local xp = tonumber(getAccountData(account, "EXP")) or 0 local cas = tonumber(getAccountData(account, "Cash")) or 0 local mapp = tonumber(getAccountData(account, "Maps")) or 0 local bmap = tonumber(getAccountData(account, "BuyMaps")) or 0 local luc = tonumber(getAccountData(account, "Lucky")) or 0 local sou = tonumber(getAccountData(account, "Sound")) or 0 triggerClientEvent(source,"myEvent",root,win,dead,tim,hunt,xp,cas,mapp,bmap,luc,sou) end end end addEventHandler("onPlayerLogin",root, statss ) addEventHandler("onElementDataChange",root, statss ) Working fine too
-
Works! Thanks! Got some questions 1.My data of wins is 0 so in label shows a "nil" Deaths working fine and other all data that is above 0 Possible to show it as 0 not as nil ? Did it no needed anymore 2. Update stats ? Bec it updates only on login How to ?
-
Same line error: attempt to concatenate local win (a nil value)
-
Yep, all client file wich includes labels
-
It didnt outPut but i saw something in DB: attempt to index global GUIEditor_Label a nil value on that line: guiSetText(GUIEditor_Label[2]," Wins:"..win)
-
Not sure how to do that.. My En is not so well, but i understand a lot compared past
-
It doesn't I made a stats check cmd: function publicstatsinfo( ) if isElement( source ) then local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local askdname = getPlayerName( source ) local wins = getAccountData( account, "Wins" ) or 0 local deaths = getAccountData( account, "Deaths" ) or 0 local played = getAccountData( account, "Time" ) or 0 local hunt = getAccountData( account, "Hunters" ) or 0 local expp = getAccountData( account, "EXP" ) or 0 local money = getAccountData( account, "Cash" ) or 0 local map = getAccountData( account, "Maps" ) or 0 local buymap = getAccountData( account, "BuyMaps" ) or 0 local luck = getAccountData( account, "Lucky" ) or 0 local sound = getAccountData( account, "Sound" ) or 0 if deaths and wins and played then outputChatBox("STATS TEST Wins: ".. tostring( wins ) .." Deaths: "..tostring( deaths ).." Time: "..tostring( played ).." Hunters: "..tostring( hunt ).." Maps: "..tostring( map ).." Exp: "..tostring( expp ).." Cash: "..tostring( money ).." Buy maps: "..tostring( buymap ).." Lucky: "..tostring( luck ).." Sound: "..tostring( sound ).."", root, 255, 12, 15, true) else outputChatBox("" , root, 255, 12, 15, true) end end else outputChatBox( "" ) end end addEvent( "stats", true ) addEventHandler( "stats", root, publicstatsinfo ) ----------------------------- function checkCommand( message, messageType ) if messageType == 0 then if message == "!stats" then triggerEvent( "stats", source ) cancelEvent( ) end end end addEventHandler( "onPlayerChat", root, checkCommand ) The data is alright all scripts forking fine. Looks like the guiSetText dont even works, it doesn't change any. No errors in ds 3.
-
But that does not work.. SERVER addEventHandler("onPlayerLogin",root, function() local account = getPlayerAccount( source ) local win = tonumber(getAccountData(account, "Wins")) local dead = tonumber(getAccountData(account, "Deaths")) triggerClientEvent(source,"myEvent",root,win,dead) end ) CLIENT addEvent("myEvent",true) addEventHandler("myEvent",root, function(win, dead) guiSetText(GUIEditor_Label[2]," Wins:"..win) guiSetText(GUIEditor_Label[3]," Deaths:"..dead) end )
-
Lets start from the begin, im sure you guys didnt understand what i want to do. Here's the label: GUIEditor_label[2] = guiCreateLabel((screen_width-507)/2,(screen_height-257)/2, 100, 180, " Wins:", false) Part from the server: addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local rWins = getAccountData( account,"Wins" ) or 0 local rDeaths = getAccountData( account,"Deaths" ) or 0 local rTime = getAccountData( account,"Time" ) or 0 local rHunters = getAccountData( account,"Hunters" ) or 0 local rEXP = getAccountData( account,"EXP" ) or 0 local rCash = getAccountData( account,"Cash" ) or 0 local rMaps = getAccountData( account,"Maps" ) or 0 local rBuyMaps = getAccountData( account,"BuyMaps" ) or 0 local rLucky = getAccountData( account,"Lucky" ) or 0 local rSound = getAccountData( account,"Sound" ) or 0 setElementData( source,"Wins",tostring( rWins ) ) setElementData( source,"Deaths",tostring( rDeaths ) ) setElementData( source,"Time",tostring( rTime ) ) setElementData( source,"Hunters",tostring( rHunters ) ) setElementData( source,"EXP",tostring( rEXP ) ) setElementData( source,"Cash",tostring( rCash ) ) setElementData( source,"Maps",tostring( rMaps ) ) setElementData( source,"BuyMaps",tostring( rBuyMaps ) ) setElementData( source,"Lucky",tostring( rLucky ) ) setElementData( source,"Sound",tostring( rSound ) ) end end ) I want to getAccountData in to labels to display my wins data. I have other labels so i need an example for wins .
-
SERVER SIDE addEventHandler("onPlayerLogin",root, function() local account = getPlayerAccount( source ) local win = tonumber(getAccountData(account, "Wins")) local dead = tonumber(getAccountData(account, "Deaths")) triggerClientEvent(source,"myEvent",win,dead) end ) CLIENT SIDE addEvent("myEvent",true) addEventHandler("myEvent",root, function(win, dead) guiSetText(GUIEditor_Label[2]," Wins:"..win) guiSetText(GUIEditor_Label[3]," Deaths:"..dead) end ) Dont work i dont know why
-
Cause the server side code already made and i dont want to edit onPlayerLogin in that case i will ruine my code..
-
Here's the code already for onPlayerLogin addEventHandler( "onPlayerLogin",root, function ( ) local account = getPlayerAccount( source ) if account then if isGuestAccount( account ) then return end local rWins = getAccountData( account,"Wins" ) or 0 local rDeaths = getAccountData( account,"Deaths" ) or 0 local rTime = getAccountData( account,"Time" ) or 0 local rHunters = getAccountData( account,"Hunters" ) or 0 local rEXP = getAccountData( account,"EXP" ) or 0 local rCash = getAccountData( account,"Cash" ) or 0 local rMaps = getAccountData( account,"Maps" ) or 0 local rBuyMaps = getAccountData( account,"BuyMaps" ) or 0 local rLucky = getAccountData( account,"Lucky" ) or 0 local rSound = getAccountData( account,"Sound" ) or 0 setElementData( source,"Wins",tostring( rWins ) ) setElementData( source,"Deaths",tostring( rDeaths ) ) setElementData( source,"Time",tostring( rTime ) ) setElementData( source,"Hunters",tostring( rHunters ) ) setElementData( source,"EXP",tostring( rEXP ) ) setElementData( source,"Cash",tostring( rCash ) ) setElementData( source,"Maps",tostring( rMaps ) ) setElementData( source,"BuyMaps",tostring( rBuyMaps ) ) setElementData( source,"Lucky",tostring( rLucky ) ) setElementData( source,"Sound",tostring( rSound ) ) end end ) And i have to get data for each label.
-
One more Q. Heres the label: GUIEditor_label[2] = guiCreateLabel((screen_width-507)/2,(screen_height-257)/2, 100, 180, " Wins:", false) guiLabelSetHorizontalAlign(GUIEditor_label[2], "left", false) guiLabelSetVerticalAlign(GUIEditor_label[2], "center") And Heres data from server side: local wins = getAccountData( account, "Wins" ) or 0 local deaths = getAccountData( account, "Deaths" ) or 0 local played = getAccountData( account, "Time" ) or 0 local hunt = getAccountData( account, "Hunters" ) or 0 local expp = getAccountData( account, "EXP" ) or 0 local money = getAccountData( account, "Cash" ) or 0 local map = getAccountData( account, "Maps" ) or 0 local buymap = getAccountData( account, "BuyMaps" ) or 0 local luck = getAccountData( account, "Lucky" ) or 0 local sound = getAccountData( account, "Sound" ) or 0 How to get data into client side in the label
-
postGUI = false] hehe Discovered it few second ago thanks for help guys ;D
-
First i have done with dx's and the with labels