Grove-MTA Posted August 22, 2014 Share Posted August 22, 2014 estoy aprendiendo a scriptear y pues tengo un script que es para bases para protejer pero para que no se mueran los usuarios hay que agregarlos al ACL pero quiero que sea por Team o por Clan esto es lo que tengo del script RestricLocation = {} TeleportLocation = {} EnabledAlarm = true TimesToKick = {} TimeSireneEnabled = true ColCuboid = false --------------------------------------- CONFIGS -------------------------------------------- RestricLocation["location1"] = {2517.1000976563, 1945.0999755859, 68.099998474121} --Local 1 RestricLocation["location2"] = {2678.3999023438, 1621.8000488281, 3.7999999523163} --LOCAL 2 TeleportLocation = {-2382.44140625, -1920.5615234375, 518.60784912109} --LOCAL TO TELEPORT PLAYER GroupName = "C.B" -- name of the acl/gang group !!! GroupNameBy = 1 -- 1 for gang name, 2 for ACL group ! cmdTurnON = "turnONcmd" -- Command to enable alarm / cmdTurnOFF = "TurnOFFcmd" -- Command to disable alarm / MsgtoKICK = "#22c1ed[[Clan M.P]] #FF0000Alejate de la base, si no perteneces al clan seras expulsado o kikeado" MsgCantCreateCollision = "Can't be created the Collision, check your location1 and location2" EnableVehicleGodMode = true -- true enabled, false disabled. KickORBAN = 1 -- 1 for kick player, 2 for BAN BanTime = 900000 -- time in seconds of ban, 900000 sec = 15 min MsgBAN = "Invadir base M.P" -- Reason of BAN ! --------------------------------------- CONFIGS -------------------------------------------- function sendMsg(iplayer,msg) outputChatBox ( msg, iplayer, 255, 255, 255, true ) end function EnterPlace ( theElement ) if (getElementType ( theElement ) == "player") and (PlayerHaveLevel (theElement) == false) and (EnabledAlarm == true ) then if(TimesToKick[theElement] > 0) then sendMsg(theElement,MsgtoKICK ..TimesToKick[theElement]) TimesToKick[theElement] = TimesToKick[theElement] -1 setElementPosition( theElement, TeleportLocation[1], TeleportLocation[2], TeleportLocation[3]) if TimeSireneEnabled == true then triggerClientEvent ( "ActiveAlarm", getRootElement() ) end sendMsgOwners(theElement) else if (KickORBAN == 1) then kickPlayer(theElement) else banPlayer ( theElement , false, false, true, "Alarme system Base", MsgBAN, BanTime ) end end elseif getElementType ( theElement ) == "vehicle" then SetVehicleGodMode(theElement,true) end end function ExitPlace ( theElement ) if getElementType ( theElement ) == "vehicle" then SetVehicleGodMode(theElement,false) end end function ASBenable1 ( source ) if(PlayerHaveLevel (source) == true) then EnabledAlarm = true end end function ASBdisable1 ( source ) if(PlayerHaveLevel (source) == true) then EnabledAlarm = false end end function ResetStats ( ) local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do if TimesToKick[aPlayer] == nil then TimesToKick[aPlayer] = 5 end if(TimesToKick[aPlayer] < 5) then TimesToKick[aPlayer] = TimesToKick[aPlayer] + 1 end end end function playerConnect ( playerNick ) local iPlayer = getPlayerFromName ( playerNick ) TimesToKick[iPlayer] = 5 end function PlayerHaveLevel( PlayerID ) if GroupNameBy == 1 then if ( getElementData ( PlayerID , "gang" ) == GroupName ) then return true else return false end else local accName = getAccountName ( getPlayerAccount ( PlayerID ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName ) ) ) then return true else return false end end end function ResourceStart( ) LoadLocations() CreateCollision() local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do TimesToKick[aPlayer] = 5 end end addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ),ResourceStart) function LoadLocations() local RX, RY, RZ, WRX, WRX, WRX if(RestricLocation["location1"][1] > RestricLocation["location2"][1]) then RestricLocation["maxx"] = RestricLocation["location1"][1] RestricLocation["minx"] = RestricLocation["location2"][1] else RestricLocation["maxx"] = RestricLocation["location2"][1] RestricLocation["minx"] = RestricLocation["location1"][1] end if(RestricLocation["location1"][2] > RestricLocation["location2"][2]) then RestricLocation["maxy"] = RestricLocation["location1"][2] RestricLocation["miny"] = RestricLocation["location2"][2] else RestricLocation["maxy"] = RestricLocation["location2"][2] RestricLocation["miny"] = RestricLocation["location1"][2] end if(RestricLocation["location1"][3] > RestricLocation["location2"][3]) then RestricLocation["maxz"] = RestricLocation["location1"][3] RestricLocation["minz"] = RestricLocation["location2"][3] else RestricLocation["maxz"] = RestricLocation["location2"][3] RestricLocation["minz"] = RestricLocation["location1"][3] end end function CreateCollision() RX = RestricLocation["minx"] WRX = RestricLocation["maxx"] - RestricLocation["minx"] RY = RestricLocation["miny"] WRY = RestricLocation["maxy"] - RestricLocation["miny"] RZ = RestricLocation["minz"] WRZ = RestricLocation["maxz"] - RestricLocation["minz"] ColCuboid = createColCuboid ( RX, RY, RZ, WRX, WRY, WRZ ) if ColCuboid then addEventHandler ( "onColShapeHit", ColCuboid, EnterPlace ) addEventHandler ( "onColShapeLeave", ColCuboid, ExitPlace ) else outputDebugString(MsgCantCreateCollision) end end function ResourceStop( ) destroyElement ( ColCuboid ) end addEventHandler( "onResourceStop", getResourceRootElement( getThisResource() ),ResourceStop) function SireneEnabled() TimeSireneEnabled = true end function sendMsgOwners( PlayerID ) local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do if(PlayerHaveLevel (aPlayer) == true) then sendMsg(aPlayer," O Jogador " ..getPlayerName ( PlayerID ) .." esta tentando invadir a sua BASE !") end end end function SetVehicleGodMode( VehicleID, godEoD ) if EnableVehicleGodMode == true then setElementData(VehicleID, "godmode", godEoD) setVehicleDamageProof (VehicleID, godEoD ) end end setTimer ( SireneEnabled , 20000, 0, "" ) setTimer ( ResetStats , 15000, 0, "" ) addCommandHandler(cmdTurnON, ASBenable1 ) addCommandHandler(cmdTurnOFF, ASBdisable1 ) addEventHandler ("onPlayerConnect", getRootElement(), playerConnect) Link to comment
./BlackBird# Posted August 22, 2014 Share Posted August 22, 2014 Spanish board viewforum.php?f=122 Link to comment
DarkAruna97 Posted August 22, 2014 Share Posted August 22, 2014 Usa este donde dice "Hielo" cambiale al nombre del clan Respetando Mayuscula y Minuscula. Dsp cambia las Cordenada location1 y 2 y el warp cuando no son del clan y ya. Para que el resouce kicke a un usuario Agrega al ACL ADMIN a esta resource. RestricLocation = {} TeleportLocation = {} EnabledAlarm = true TimesToKick = {} TimeSireneEnabled = true ColCuboid = false --------------------------------------- CONFIGS -------------------------------------------- RestricLocation["location1"] = {-3215.5988769531,-6.7002897262573,12.6000003814} --Local 1 RestricLocation["location2"] = {-3368.6635742188,260.32647705078,81.217094421387} --LOCAL 2 TeleportLocation = {-3171.1320800781,125.37756347656,12.539682388306} --LOCAL TO TELEPORT PLAYER GroupName = "Hielo" -- name of the acl/gang group !!! GroupNameBy = 1 -- 1 for gang name, 2 for ACL group ! cmdTurnON = "turnONcmd" -- Command to enable alarm / cmdTurnOFF = "turnOFFcmd" -- Command to disable alarm / MsgtoKICK = "No puedes entrar a la base:" MsgCantCreateCollision = "Can't be created the Collision, check your location1 and location2" EnableVehicleGodMode = true -- true enabled, false disabled. KickORBAN = 1 -- 1 for kick player, 2 for BAN BanTime = 900000 -- time in seconds of ban, 900000 sec = 15 min MsgBAN = "Intruso" -- Reason of BAN ! --------------------------------------- CONFIGS -------------------------------------------- function sendMsg(iplayer,msg) outputChatBox ( msg, iplayer, 255, 255, 255, true ) end function EnterPlace ( theElement ) if (getElementType ( theElement ) == "player") and (PlayerHaveLevel (theElement) == false) and (EnabledAlarm == true ) then if(TimesToKick[theElement] > 0) then sendMsg(theElement,MsgtoKICK ..TimesToKick[theElement]) TimesToKick[theElement] = TimesToKick[theElement] -1 setElementPosition( theElement, TeleportLocation[1], TeleportLocation[2], TeleportLocation[3]) if TimeSireneEnabled == true then triggerClientEvent ( "ActiveAlarm", getRootElement() ) end sendMsgOwners(theElement) else if (KickORBAN == 1) then kickPlayer(theElement) else banPlayer ( theElement , false, false, true, "Alarme system Base", MsgBAN, BanTime ) end end elseif getElementType ( theElement ) == "vehicle" then SetVehicleGodMode(theElement,true) end end function ExitPlace ( theElement ) if getElementType ( theElement ) == "vehicle" then SetVehicleGodMode(theElement,false) end end function ASBenable1 ( source ) if(PlayerHaveLevel (source) == true) then EnabledAlarm = true end end function ASBdisable1 ( source ) if(PlayerHaveLevel (source) == true) then EnabledAlarm = false end end function ResetStats ( ) local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do if TimesToKick[aPlayer] == nil then TimesToKick[aPlayer] = 5 end if(TimesToKick[aPlayer] < 5) then TimesToKick[aPlayer] = TimesToKick[aPlayer] + 1 end end end function playerConnect ( playerNick ) local iPlayer = getPlayerFromName ( playerNick ) TimesToKick[iPlayer] = 5 end function PlayerHaveLevel( PlayerID ) if GroupNameBy == 1 then if ( getElementData ( PlayerID , "gang" ) == GroupName ) then return true else return false end else local accName = getAccountName ( getPlayerAccount ( PlayerID ) ) if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( GroupName ) ) ) then return true else return false end end end function ResourceStart( ) LoadLocations() CreateCollision() local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do TimesToKick[aPlayer] = 5 end end addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ),ResourceStart) function LoadLocations() local RX, RY, RZ, WRX, WRX, WRX if(RestricLocation["location1"][1] > RestricLocation["location2"][1]) then RestricLocation["maxx"] = RestricLocation["location1"][1] RestricLocation["minx"] = RestricLocation["location2"][1] else RestricLocation["maxx"] = RestricLocation["location2"][1] RestricLocation["minx"] = RestricLocation["location1"][1] end if(RestricLocation["location1"][2] > RestricLocation["location2"][2]) then RestricLocation["maxy"] = RestricLocation["location1"][2] RestricLocation["miny"] = RestricLocation["location2"][2] else RestricLocation["maxy"] = RestricLocation["location2"][2] RestricLocation["miny"] = RestricLocation["location1"][2] end if(RestricLocation["location1"][3] > RestricLocation["location2"][3]) then RestricLocation["maxz"] = RestricLocation["location1"][3] RestricLocation["minz"] = RestricLocation["location2"][3] else RestricLocation["maxz"] = RestricLocation["location2"][3] RestricLocation["minz"] = RestricLocation["location1"][3] end end function CreateCollision() RX = RestricLocation["minx"] WRX = RestricLocation["maxx"] - RestricLocation["minx"] RY = RestricLocation["miny"] WRY = RestricLocation["maxy"] - RestricLocation["miny"] RZ = RestricLocation["minz"] WRZ = RestricLocation["maxz"] - RestricLocation["minz"] ColCuboid = createColCuboid ( RX, RY, RZ, WRX, WRY, WRZ ) if ColCuboid then addEventHandler ( "onColShapeHit", ColCuboid, EnterPlace ) addEventHandler ( "onColShapeLeave", ColCuboid, ExitPlace ) else outputDebugString(MsgCantCreateCollision) end end function ResourceStop( ) destroyElement ( ColCuboid ) end addEventHandler( "onResourceStop", getResourceRootElement( getThisResource() ),ResourceStop) function SireneEnabled() TimeSireneEnabled = true end function sendMsgOwners( PlayerID ) local connectedPlayers = getElementsByType ( "player" ) for i, aPlayer in ipairs(connectedPlayers) do if(PlayerHaveLevel (aPlayer) == true) then sendMsg(aPlayer," #FF0000[ALARMA] El Jugador " ..getPlayerName ( PlayerID ) .." Estan intentando entrar a su base!") end end end function SetVehicleGodMode( VehicleID, godEoD ) if EnableVehicleGodMode == true then setElementData(VehicleID, "godmode", godEoD) setVehicleDamageProof (VehicleID, godEoD ) end end setTimer ( SireneEnabled , 20000, 0, "" ) setTimer ( ResetStats , 15000, 0, "" ) addCommandHandler(cmdTurnON, ASBenable1 ) addCommandHandler(cmdTurnOFF, ASBdisable1 ) addEventHandler ("onPlayerConnect", getRootElement(), playerConnect) Link to comment
Recommended Posts