Wei Posted May 20, 2012 Share Posted May 20, 2012 function setPlayerGangLeader( thePlayer, command, sPlayer ) local dPlayer = getPlayerFromName( sPlayer ) local acc = getPlayerAccount( thePlayer ) local dAcc = getPlayerAccount( dPlayer ) if getAccountData( acc, "GroupRank" ) == "gangLeader" then if getAccountData( dAcc, "Group" ) == getAccountData( acc, "Group" ) then setAccountData( dAcc, "GroupRank", "gangLeader" ) else outputChatBox("error") end end end addCommandHandler( "setGangLeader", setPlayerGangLeader ) ERROR [2012-05-20 13:40:02] WARNING: group\server.lua:79: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got boolean] [2012-05-20 13:40:02] WARNING: group\server.lua:81: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] Link to comment
Genius Posted May 20, 2012 Share Posted May 20, 2012 (edited) Maybe function setPlayerGangLeader( thePlayer, command, sPlayer, dPlayer ) local dPlayer = getPlayerFromName( sPlayer ) local acc = getPlayerAccount( thePlayer ) local dAcc = getPlayerAccount( dPlayer ) if getAccountData( acc, "GroupRank" ) == "gangLeader" then if getAccountData( dAcc, "Group" ) == getAccountData( acc, "Group" ) then setAccountData( dAcc, "GroupRank", "gangLeader" ) else outputChatBox("error") end end end addCommandHandler( "setGangLeader", setPlayerGangLeader ) Edited May 20, 2012 by Guest Link to comment
Kenix Posted May 20, 2012 Share Posted May 20, 2012 This line return boolean instead of player element. local dPlayer = getPlayerFromName( sPlayer ) Player not found. Link to comment
Wei Posted May 20, 2012 Author Share Posted May 20, 2012 Fixed. The code was ok but I typed the wrong name. 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