opnaiC Posted July 9, 2016 Share Posted July 9, 2016 Hello, I made a faction script for grove street gang. The gang script is fully working. But to test the gang script I have to set me as a member of the gang. The gang has two markers one for ammo and one for the skin. So when I am using my function the set my rank and faction (script below) and I am hitting the skin marker it says in console: getElementData nil I know what its standing for but I dont know why my rankme script is not working ... I hope you can help me Also its outputting in the chat "working", so it should work but it doesnt.. function rankMySelf (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local oFaction = getElementData(thePlayer, "Faction") if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(iFaction) == nil then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end addCommandHandler( "rankme", rankMySelf, false, false) Link to comment
Bean666 Posted July 9, 2016 Share Posted July 9, 2016 you had a typo should be oFaction not iFaction function rankMySelf (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local oFaction = getElementData(thePlayer, "Faction") if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(oFaction) == nil then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end addCommandHandler( "rankme", rankMySelf) Link to comment
opnaiC Posted July 9, 2016 Author Share Posted July 9, 2016 you had a typo should be oFaction not iFaction function rankMySelf (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local oFaction = getElementData(thePlayer, "Faction") if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(oFaction) == nil then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end addCommandHandler( "rankme", rankMySelf) Still dont working Link to comment
Walid Posted July 9, 2016 Share Posted July 9, 2016 Try this function rankMySelf (thePlayer) local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then local accName = getAccountName (account) local oFaction = getElementData(thePlayer, "Faction") or 0 if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(oFaction) == 0 then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end end addCommandHandler( "rankme", rankMySelf) Link to comment
opnaiC Posted July 9, 2016 Author Share Posted July 9, 2016 Try this function rankMySelf (thePlayer) local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then local accName = getAccountName (account) local oFaction = getElementData(thePlayer, "Faction") or 0 if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(oFaction) == 0 then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end end addCommandHandler( "rankme", rankMySelf) Its not outputting working and I have the same problem Link to comment
Walid Posted July 9, 2016 Share Posted July 9, 2016 Its not outputting working and I have the same problem Working fine for me. Make sure it's server side You need to be logged in. You need to be in admin ACL group. Check if it's "Admin" or "admin". Link to comment
Bean666 Posted July 9, 2016 Share Posted July 9, 2016 i tried mine / walid's code and it seems working. 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