1LoL1 Posted April 17, 2015 Share Posted April 17, 2015 Why this not work? rootElement = getRootElement() function onPlayerSpawnHandler () if(accountName) then if(isObjectInACLGroup("user."..accountName, aclGetGroup("VIP"))) then setPedArmor( source, 100 ) end addEventHandler( "onPlayerSpawn", rootElement, onPlayerSpawnHandler ) Link to comment
xXMADEXx Posted April 18, 2015 Share Posted April 18, 2015 accountName sint defined, and you didnt end the if statements. function onPlayerSpawnHandler () local account = getPlayerAccount ( source ); if ( not account or isGuestAccount ( account ) ) then return false; end local accountName = getAccountName ( account ); if ( accountName and isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "VIP" ) ) ) then setPedArmor ( source, 100 ); end end addEventHandler( "onPlayerSpawn", root, onPlayerSpawnHandler ) Link to comment
1LoL1 Posted April 18, 2015 Author Share Posted April 18, 2015 accountName sint defined, and you didnt end the if statements. function onPlayerSpawnHandler () local account = getPlayerAccount ( source ); if ( not account or isGuestAccount ( account ) ) then return false; end local accountName = getAccountName ( account ); if ( accountName and isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "VIP" ) ) ) then setPedArmor ( source, 100 ); end end addEventHandler( "onPlayerSpawn", root, onPlayerSpawnHandler ) Error: ERROR: Loading script failed: test/test.lua:8: unexpected symbol near ")" Link to comment
Walid Posted April 18, 2015 Share Posted April 18, 2015 try this : function onPlayerSpawnHandler () local account = getPlayerAccount ( source ) if ( not account or isGuestAccount ( account ) ) then return end if ( isObjectInACLGroup ( "user." .. getAccountName (account) , aclGetGroup ( "VIP" ) ) ) then setPedArmor ( source, 100 ) end end addEventHandler( "onPlayerSpawn", root, onPlayerSpawnHandler ) Link to comment
1LoL1 Posted April 18, 2015 Author Share Posted April 18, 2015 try this : function onPlayerSpawnHandler () local account = getPlayerAccount ( source ) if ( not account or isGuestAccount ( account ) ) then return end if ( isObjectInACLGroup ( "user." .. getAccountName (account) , aclGetGroup ( "VIP" ) ) ) then setPedArmor ( source, 100 ) end end addEventHandler( "onPlayerSpawn", root, onPlayerSpawnHandler ) Not work and 0 errors. Link to comment
Dimos7 Posted April 18, 2015 Share Posted April 18, 2015 function onPlayerSoawnHandler(player) local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return end if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP"))) then setPlayerArmor(player, 100) end end addEventHandler("onPlayerSpawn", getRootElement(), onPlayerSpawnHandler) Link to comment
Walid Posted April 18, 2015 Share Posted April 18, 2015 function onPlayerSoawnHandler(player) local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return end if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP"))) then setPlayerArmor(player, 100) end end addEventHandler("onPlayerSpawn", getRootElement(), onPlayerSpawnHandler) lol the source of this event is the player that just spawned. Link to comment
Dimos7 Posted April 18, 2015 Share Posted April 18, 2015 he can remove the player and place the source its the same think Link to comment
Walid Posted April 18, 2015 Share Posted April 18, 2015 he can remove the player and place the source its the same think no it's not Link to comment
1LoL1 Posted April 18, 2015 Author Share Posted April 18, 2015 function onPlayerSoawnHandler(player) local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return end if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP"))) then setPlayerArmor(player, 100) end end addEventHandler("onPlayerSpawn", getRootElement(), onPlayerSpawnHandler) Not work and i dont have Gamemodes.. i have only setgamemode. Link to comment
Enargy, Posted April 18, 2015 Share Posted April 18, 2015 function onPlayerSpawnHandler() local account = getPlayerAccount(source) if (not account or isGuestAccount(account)) then return end if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP"))) then setPlayerArmor(source, 100) end end addEventHandler("onPlayerSpawn", getRootElement(), onPlayerSpawnHandler) it works. you need to creates ACL group called VIP Link to comment
#RooTs Posted April 19, 2015 Share Posted April 19, 2015 tested and working function onPlayerSpawnHandler() local account = getPlayerAccount(source) if (not account or isGuestAccount(account)) then return end if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP"))) then setPlayerArmor(source, 100) end end addEventHandler("onPlayerSpawn", getRootElement(), onPlayerSpawnHandler) Link to comment
1LoL1 Posted April 19, 2015 Author Share Posted April 19, 2015 tested and working function onPlayerSpawnHandler() local account = getPlayerAccount(source) if (not account or isGuestAccount(account)) then return end if (isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP"))) then setPlayerArmor(source, 100) end end addEventHandler("onPlayerSpawn", getRootElement(), onPlayerSpawnHandler) Thanks. Work 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