Flipi Posted August 19, 2013 Share Posted August 19, 2013 Necesito ayuda con mi script, se trata de que un grupo de ACL tiene acceso a armas, mientras que los que no pertenecen al grupo no pueden acceder a esas armas. armas = { [38] = true ; [35] = true ; [36] = true ; [37] = true ; [16] = true ; [17] = true ; [18] = true ; [39] = true ; function antiweapon ( previousWeaponID, currentWeaponID ) if ( armas[getElementModel ( source )] ) and ( seat == 0 ) then local weapon = getWeaponNameFromID ( currentWeaponID ) local accountName = getAccountName ( getPlayerAccount ( player ) ) if ( not isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Secret" ) ) ) then cancelEvent ( ) outputChatBox("Estas armas son solo para ~Secret Option~", thePlayer, 0,128,255, true) end end end addEventHandler ( "onPlayerWeaponSwitch", root, antiweapon ) Link to comment
AlvareZ_ Posted August 19, 2013 Share Posted August 19, 2013 armas = { [38] = true ; [35] = true ; [36] = true ; [37] = true ; [16] = true ; [17] = true ; [18] = true ; [39] = true } function antiweapon ( previousWeaponID, currentWeaponID, thePlayer ) if ( armas[getElementModel ( thePlayer )] ) and ( seat == 0 ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if ( not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Secret" ) ) then cancelEvent ( ) outputChatBox("Estas armas son solo para ~Secret Option~", thePlayer, 0,128,255, true) end end end addEventHandler ( "onPlayerWeaponSwitch", root, antiweapon ) Link to comment
MTA Team 0xCiBeR Posted August 19, 2013 MTA Team Share Posted August 19, 2013 Eso no andaria, ya que "seat" no esta definido Link to comment
Sensacion Posted August 19, 2013 Share Posted August 19, 2013 armas = { [38] = true, [35] = true, [36] = true, [37] = true, [16] = true, [17] = true, [18] = true, [39] = true } function antiweapon ( previousWeaponID, currentWeaponID ) if ( armas[ currentWeaponID ] ) then if ( not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Secret" ) ) ) then cancelEvent ( ) outputChatBox("Estas armas son solo para ~Secret Option~", source, 0,128,255, true) end end end addEventHandler ( "onPlayerWeaponSwitch", root, antiweapon ) Pero creo que mejor sería evitar que dispare poniendo en false el toggleControl Link to comment
Flipi Posted August 19, 2013 Author Share Posted August 19, 2013 Pero donde se pondria el togglecontrol? asi? armas = { [38] = true, [35] = true, [36] = true, [37] = true, [16] = true, [17] = true, [18] = true, [39] = true } function antiweapon ( previousWeaponID, currentWeaponID ) if ( armas[ currentWeaponID ] ) then toggleControl ( source, "fire", false ) if ( not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Secret" ) ) ) then cancelEvent ( ) outputChatBox("Estas armas son solo para ~Secret Option~", source, 0,128,255, true) end end end addEventHandler ( "onPlayerWeaponSwitch", root, antiweapon ) Link to comment
AlvareZ_ Posted August 19, 2013 Share Posted August 19, 2013 armas = { [38] = true, [35] = true, [36] = true, [37] = true, [16] = true, [17] = true, [18] = true, [39] = true } function antiweapon ( previousWeaponID, currentWeaponID, source) if ( armas[ currentWeaponID ] ) then if ( not isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Secret" ) ) ) then cancelEvent ( ) toggleControl ( source, "fire", false ) outputChatBox("Estas armas son solo para ~Secret Option~", source, 0,128,255, true) end end end addEventHandler ( "onPlayerWeaponSwitch", root, antiweapon ) Link to comment
Flipi Posted August 19, 2013 Author Share Posted August 19, 2013 hay un problema con el acl group [Error]: armaspriv\armaspriv.lua:14: attempt to concatenate global 'accountName' Link to comment
AlvareZ_ Posted August 19, 2013 Share Posted August 19, 2013 armas = { [38] = true, [35] = true, [36] = true, [37] = true, [16] = true, [17] = true, [18] = true, [39] = true } function antiweapon ( previousWeaponID, currentWeaponID, source) if ( armas[ currentWeaponID ] ) then local accName = getAccountName ( getPlayerAccount ( source ) ) if ( not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Secret" ) ) ) then cancelEvent ( ) toggleControl ( source, "fire", false ) outputChatBox("Estas armas son solo para ~Secret Option~", source, 0,128,255, true) end end end addEventHandler ( "onPlayerWeaponSwitch", root, antiweapon ) Link to comment
Flipi Posted August 19, 2013 Author Share Posted August 19, 2013 me confundi, es server-side? o client? Link to comment
GamerDeMTA Posted August 19, 2013 Share Posted August 19, 2013 es server side, mira las funcions que hay de color amarillo significan q son solo de server side. Link to comment
Recommended Posts