TarkFox Posted January 23, 2014 Share Posted January 23, 2014 hola, quiero que me ayuden con esto, este resource trata de cuando uno pone un comando, te cambia al team staff, eres invencible, (no mueres) pero yo quiero cambiarle algunas cosas, quiero que cambiar el comando, la ocupacion que aparesca en TAB y hacer correr el adminchat, que no me funciona. ok quiero que sea asi, para que funcione, para cambiarme de team, poner el comando /equipoadm, en la ocupacion que aparesca como los niveles, lvl 1, Staff Trial Lv1, lvl 2 Staff Para Ayudas Lv2, lvl 3 Moderador Lv3, lvl 4 Administrador Lv4, lvl5 Creador/Lider De Fuerzas Armadas.(puse lvl 1, lvl 2, lvl 3, lvl 4, lvl 5, porque asi me sale en los grupos del ACL) esto se llama Server1.lua function createTeamsOnStart () teamstaff = createTeam ( "Staff", 255, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function lol ( player, command ) setPlayerTeam ( player, teamstaff ) setElementModel(player, 217) setPlayerNametagColor ( player, 255, 255, 255 ) end addCommandHandler ( "staff", lol ) este se llama staffserver.lua function togglestaffMode(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) local admin = "Admin" local staff1 = "New Staff" local staff2 = "Trained Staff" local staff3 = "Trusted Staff" local staff4 = "High Staff" local staff5 = "Head Staff" local moderator = "Moderator" local owner = "Owner" local mapper = "Mapper" local die = "N/A" if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "stafflevel1" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Your Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff1) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "stafflevel2" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff2) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "stafflevel3" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff3) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "stafflevel4" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff4) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", mod) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", admin) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Owner" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", owner) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Mapper" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", mapper) end end end addCommandHandler("staff",togglestaffMode) este se llama adminchat.lua function adminChat( thePlayer,_,... ) local text = table.concat( {...}, " " ) local name = getPlayerName( thePlayer ) for _,v in pairs( getPlayersInGroup( accName ) ) do outputChatBox ("#FF0000(CMD) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) end end addCommandHandler("cmd", adminChat) function getPlayersInGroup( accName ) local Table = { } for _,v in pairs( getElementsByType( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( v ) ) if (isObjectInACLGroup ("user." .. accName, aclGetGroup("SuperAdmin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("lvl 1")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("lvl 2")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("lvl 3")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("lvl 4")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("lvl 5")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("Mapper")) or isObjectInACLGroup ("user." .. accName, aclGetGroup("Console")) ) then table.insert( Table,v ) end end return Table end Link to comment
MTA Team 0xCiBeR Posted January 23, 2014 MTA Team Share Posted January 23, 2014 Para cambiar el comando editas esto en el staffserver.lua: addCommandHandler("staff",togglestaffMode)--cambias "staff" por lo que quieras, siempre dejando las comillas. Y en cuanto a que aparezca en el scoreboard, cambia el serverstaff.lua a esto: exports.scoreboard:addScoreboardColumn ( "Occupation", 3 ) function togglestaffMode(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) local admin = "Admin" local staff1 = "New Staff" local staff2 = "Trained Staff" local staff3 = "Trusted Staff" local staff4 = "High Staff" local staff5 = "Head Staff" local moderator = "Moderator" local owner = "Owner" local mapper = "Mapper" local die = "N/A" if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "stafflevel1" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Your Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff1) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "stafflevel2" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff2) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "stafflevel3" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff3) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "stafflevel4" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", staff4) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", mod) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", admin) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Owner" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", owner) end elseif ( isObjectInACLGroup ("user.".. accountName, aclGetGroup ( "Mapper" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) setElementData(thePlayer, "Occupation", die) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) setElementData(thePlayer, "Occupation", mapper) end end end addCommandHandler("staff",togglestaffMode) Link to comment
Recommended Posts