Xeno Posted January 22, 2012 Share Posted January 22, 2012 function checkRank(player) local account = getPlayerAccount(player) if (account) then if (isGuestAccount(account)) then outputChatBox("hello") end This gives me a bad arguement at "getPlayerAccount".. Please help me, Thanks, Xeno. Link to comment
Castillo Posted January 22, 2012 Share Posted January 22, 2012 function checkRank(player) local account = getPlayerAccount(player) if (account and isGuestAccount(account)) then outputChatBox("hello") end end Show us how you execute "checkRank" function. Link to comment
Xeno Posted January 22, 2012 Author Share Posted January 22, 2012 This is how I execute it: function checkRank(player) local account = getPlayerAccount(player) if (account and isGuestAccount(account)) then setElementData(player, "Rank","Login") local kills = tonumber(getElementData(player,"Zombie kills")) elseif (kills >= 25 and kills <= 49) then setElementData(player, "Rank","Rookie") end end addEventHandler("onPlayerLogout", getRootElement(), checkRank) addEventHandler("onPlayerLogin", getRootElement(), checkRank) addEventHandler("onPlayerJoin", getRootElement(), checkRank) I ran into some problems: 12:attempted to compare number with nil and... Bad argument at getPlayerAccount Link to comment
Castillo Posted January 22, 2012 Share Posted January 22, 2012 function checkRank() local account = getPlayerAccount(source) if (account and isGuestAccount(account)) then setElementData(source, "Rank","Login") return end local kills = tonumber(getElementData(source,"Zombie kills")) if (kills >= 25 and kills <= 49) then setElementData(source, "Rank","Rookie") end end addEventHandler("onPlayerLogout", getRootElement(), checkRank) addEventHandler("onPlayerLogin", getRootElement(), checkRank) Link to comment
Xeno Posted January 22, 2012 Author Share Posted January 22, 2012 Works perfectly, thank you. 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