Xeno Posted September 28, 2011 Share Posted September 28, 2011 1. How would I make it so if an Admin logged on, his team would be changed to admin? Heres what I got so far... function onAdminJoin() if isObjectInACLGroup("user." .. playerName, aclGetGroup ("Admin" ) ) then local team =getTeamFromName("Admins") setPlayerTeam (source, team) end addEventHandler("onPlayerLogin", getRootElement(), onAdminJoin) This doesnt seem to work... Please help Link to comment
Static-X Posted September 28, 2011 Share Posted September 28, 2011 playerName isn't defined, you can use this function onAdminJoin(_,account) local account = getAccountName ( account ) if ( isObjectInACLGroup ( "user." .. account, aclGetGroup ( "Admin" ) ) ) then local team = getTeamFromName ( "Admins" ) setPlayerTeam( source, team ) end end addEventHandler("onPlayerLogin", getRootElement(), onAdminJoin) Link to comment
HunT Posted September 28, 2011 Share Posted September 28, 2011 Made The Indipenden Function and call with setTimer example : function onAdminJoin(player) function setAdminTeam() setTimer(onAdminJoin,500,1,source) end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) For More info Look this my script : function setAdminColor(player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then local adminInVehicle = getPedOccupiedVehicle ( player ) setVehicleColor ( adminInVehicle, 3, 0, 0, 0 ) -- Change Color Here end end end function spawnAdmin() setTimer(setAdminColor,500,1,source) end addEventHandler("onPlayerSpawn",getRootElement(),spawnAdmin) Change the onPlayerSpawn with onPlayerLogin Link to comment
Xeno Posted September 28, 2011 Author Share Posted September 28, 2011 Made The Indipenden Function and call with setTimerexample : function onAdminJoin(player) function setAdminTeam() setTimer(onAdminJoin,500,1,source) end addEventHandler("onPlayerLogin",getRootElement(),setAdminTeam) For More info Look this my script : function setAdminColor(player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then local adminInVehicle = getPedOccupiedVehicle ( player ) setVehicleColor ( adminInVehicle, 3, 0, 0, 0 ) -- Change Color Here end end end function spawnAdmin() setTimer(setAdminColor,500,1,source) end addEventHandler("onPlayerSpawn",getRootElement(),spawnAdmin) Change the onPlayerSpawn with onPlayerLogin I get two erros when I login: Bad argument @ getPlayerAccount [Expected Elemtn at argument , got nil] attenmpt to concatenate global "accountName" (a nil value) Link to comment
HunT Posted September 28, 2011 Share Posted September 28, 2011 This : function setAdminTeam(player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then local team = getTeamFromName ( "Admins" ) setPlayerTeam( player, team ) end end end function teamAdmin() setTimer(setAdminTeam,500,1,source) end addEventHandler("onPlayerLogin",getRootElement(),teamAdmin) ServerSide and add the resource in ACL group admin Link to comment
Xeno Posted September 29, 2011 Author Share Posted September 29, 2011 This : function setAdminTeam(player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then local team = getTeamFromName ( "Admins" ) setPlayerTeam( player, team ) end end end function teamAdmin() setTimer(setAdminTeam,500,1,source) end addEventHandler("onPlayerLogin",getRootElement(),teamAdmin) ServerSide and add the resource in ACL group admin That has worked perfectly, thanks a bunch :3 And thanks for all the other people who put in information to<3 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