HoLsTeN Posted October 8, 2011 Posted October 8, 2011 hi all function getPlayerStats ( source, command, who ) local targetPlayer = getPlayerFromName ( who ) if ( targetPlayer ) then -- if find local playeraccount = getPlayerAccount(targetPlayer) local who_exp = getAccountData(playeraccount,"exp") local who_lvl = getAccountData(playeraccount,"level") local who_rank = getAccountData(playeraccount,"rank") outputChatBox (getPlayerName(source) .." #0000FF Ask #FFFF00For #FFFFFF".. getPlayerName(targetPlayer) .." #0000FFStats : ",getRootElement(),255,255,255,true) outputChatBox (getPlayerName(targetPlayer) .." #0000FFHis EXP : #FFFF00".. who_exp .." #0000FF! ",getRootElement(),255,255,0,true) outputChatBox (getPlayerName(targetPlayer) .." #0000FFHis LEVEL :#FFFF00 ".. who_lvl .." #0000FF! ",getRootElement(),255,255,0,true) outputChatBox (getPlayerName(targetPlayer) .." #0000FFHis RANK NAME : #FFFF00".. who_rank .." #0000FF! ",getRootElement(),255,255,0,true) else -- if he is not in the server outputChatBox("No Player With This Name",source,255,0,0) end end addCommandHandler ( "stats", getPlayerStats ) the code just show me my EXP but the others outputChatBox Not ShoW
SDK Posted October 8, 2011 Posted October 8, 2011 Check /debugscript 3 Use tostring(who_lvl) to convert numbers to strings
Aibo Posted October 8, 2011 Posted October 8, 2011 probably some account data is not set: local who_exp = getAccountData(playeraccount,"exp") or "0" local who_lvl = getAccountData(playeraccount,"level") or "0" local who_rank = getAccountData(playeraccount,"rank") or "None"
Bssol Posted October 8, 2011 Posted October 8, 2011 function getPlayerStats ( source, command, who ) local targetPlayer = getPlayerFromName ( who ) if ( targetPlayer ) then local playeraccount = getPlayerAccount(targetPlayer) if ( playeraccount ) and not ( isGuestAccount ( playeraccount ) ) then local who_exp = getAccountData(playeraccount,"exp") local who_lvl = getAccountData(playeraccount,"level") local who_rank = getAccountData(playeraccount,"rank") if not ( who_exp ) then who_exp = "0" end if not ( who_lvl ) then who_lvl = "0" end if not ( who_rank ) then who_rank = "0" end outputChatBox (getPlayerName(source) .." #0000FF Ask #FFFF00For #FFFFFF".. getPlayerName(targetPlayer) .." #0000FFStats : ",getRootElement(),255,255,255,true) outputChatBox (getPlayerName(targetPlayer) .." #0000FFHis EXP : #FFFF00".. who_exp .." #0000FF! ",getRootElement(),255,255,0,true) outputChatBox (getPlayerName(targetPlayer) .." #0000FFHis LEVEL :#FFFF00 ".. who_lvl .." #0000FF! ",getRootElement(),255,255,0,true) outputChatBox (getPlayerName(targetPlayer) .." #0000FFHis RANK NAME : #FFFF00".. who_rank .." #0000FF! ",getRootElement(),255,255,0,true) else outputChatBox(who.." doesn't have an account.",source,255,0,0) end else outputChatBox("No Player With This Name",source,255,0,0) end end addCommandHandler ( "stats", getPlayerStats )
Ignition Posted October 8, 2011 Posted October 8, 2011 Is there another part that sets account data setAccountData
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