Jump to content

Sky

Members
  • Posts

    131
  • Joined

  • Last visited

Posts posted by Sky

  1. Hi,

    i have create my first script for i set skin for the people who i want to set a skin :

    skin.lua :

    <object name="user.=Sky" skin model="24" name"Black Beachguy" /> 
    

    meta.xml :

    <meta> 
    <info author="Sky" description="Skin"/> 
    <script src="skin.lua"/> 
    </meta> 
      
    

    i start the ressource, but it don't work ! What is wrong ?

    Thx.

  2. Hi,

    i find a script for my server , this script is that the players on my server can select the skin they want and after that

    save the Skin select by nickname .

    Somebody can make this script plz ?

    Thank you very much. :D

  3. i want to use the ion canon on my server, but when i press "g" , i have :

    "Cannot activate ion cannon and nuke at the same time"

    why ?

    i have download this script for the canon ion :

    --============================================================================================================== 
    --Start defining varibles, including a players array 
    --============================================================================================================== 
    root = getRootElement () 
    players = {} 
      
    outputChatBox ( "Nulear Bomb by Ransom" ) 
    --nuke_rotX = 0 
    nuke_loops = 0 
    nuke_explosionTimer = 0 
    nuke_cloudRotationAngle = 0     
    nuke_explosionLimiter = false 
    nuke_cannonActivated = false 
    nuke_cancelActivation = false 
    players = getElementsByType ( "player" ) 
      
    --============================================================================================================== 
    --Give all players on the server access to the weapons 
    --==============================================================================================================    
    function ResourceStartNuke ( name, root ) 
    if name ~= getThisResource() then return end 
        for k,v in ipairs ( players ) do 
        -- for all players in the "players" array 
        bindKey ( v, "g", "down", placeNukeBeacon ) 
        -- bind the key g for triggering the nuke 
        end 
    end 
    addEventHandler ( "onResourceStart", root, ResourceStartNuke ) 
      
    function nukePlayerJoin () 
        bindKey ( source, "g", "down", placeNukeBeacon ) 
        --if a player joins after the resource loaded, bind their g key to trigger the nuke also 
    end 
    addEventHandler ( "onPlayerJoin", root, nukePlayerJoin ) 
      
    --==================================================================================================================== 
    --When the nuke key (g) is pressed, show the mouse cursor that will allow the triggering of the onPlayerClick function 
    --==================================================================================================================== 
    function placeNukeBeacon ( player, key, state )                                                                       
        if ( nuke_cannonActivated == false ) and ( nuke_cancelActivation == false ) and ( ion_cancelActivation == false ) and ( ion_cannonActivated == false ) then 
        --These conditions prevent triggering the same weapon twice or triggering the other weapon at the same time. 
        --Both weapons cannot be triggered because explosions are stretched to the limit, explosions would be random. 
        defineLaunchType = key 
        --This is used later on the onPlayerClick function to tell it what weapon to launch 
        showCursor ( player, true ) 
        nuke_cancelActivation = true 
        else 
            if nuke_cancelActivation == true then 
            showCursor ( player, false ) 
            end 
            --Prevents cursor from getting messed up if cursor is show for f or g and the opposite key is hit 
        nuke_cancelActivation = false 
        --nuke_cancelactivation is true when the cursor is showing. This is necessary along with asking if the actual 
        --weapon is active to prevent problems with the cursor and weapon activation between both weapons and themselves.   
                if nuke_cannonActivated == true then 
                outputChatBox ( "Nuke has already been activated", activator ) 
                else 
                outputChatBox ( "Cannot activate ion cannon and nuke at the same time", activator ) 
                end 
                --This statement says that if the nuke is already in use, display a meassage about it being in use on g press. 
                --else, if the above conditions were not satisifed and the nuke is not active, it meant the ioncannon was 
                --active. Therefore, display the other message that both weapons cannot be used at the same time. 
        end 
    end 
      
    --==================================================================================================================== 
    --When the player clicks the mouse cursor, decide if the nuke is supposed to be launched and if so, set up the launch 
    --==================================================================================================================== 
    function playerClickNuke ( button, state, clickedElement, x, y, z ) 
        if defineLaunchType == "g" then 
        --If the player clicked, we check if the key is equal to f or g. This will dictate which onPlayerClick function 
        --commences between the ion cannon and nuke scripts 
        nuke_cancelActivation = false 
        --Since the weapon is now in use, you have no chance to abort by pressing the key again, therefore this is false 
        defineLaunchType = nil 
        --This must be reset to nil so it will not fire the nuke next time on click if f was pressed instead of g (which triggers ion) 
        nuke_beaconx = x 
        nuke_beacony = y 
        nuke_beaconz = z 
        --Set the nuke beacon (detonation spot) coordinates to the spot the mouse cursor clicked on the game map 
        local playerz, playerz, playerz = getElementPosition ( source ) 
        --I put a z height limit on the nuke, because the visual image of the bomb dropping can be broken if it is set 
        --to start an explosion/visually show object deletion in a mid-air point. To prevent this, I have assigned a max 
        --nuke height that is a little bit more than the z height of the player who activated it. There is a function to 
        --grab the actual z height at an X,Y position that I will implement later. For the above line, getElementPosition 
        --outputs 3 varibles, but I only want z so I overwrote 1 varible called playerz as the function went through and 
        --assigned the XYZ values to varible x, varible y, and varible z respectively. 
        nuke_maxBeamHeight = playerz + 2 
                if nuke_beaconz > nuke_maxBeamHeight then 
                nuke_beaconz = playerz + 3 
                end 
                --resets the nuke beacon z height if it is more than +3 above player z height 
                    if ( button == "left" ) and ( state == "down" ) and ( nuke_cannonActivated == false ) then 
                    --When the left mouse button is pressed down (not when released), if nuke is not active then 
                    nuke_cannonActivated = true 
                    --Set this varible to true, which will be used to avoid double launches & double weapon usage 
                    showCursor ( source, false ) 
                    --Weapon beacon was chosen and the launch is initiating to that point. Hide cursor. 
                    setTimer ( nukeExplosion, 2700, 1 ) 
                    setTimer ( nukeShot, 500, 1 ) 
                    --Trigger these two functions that will drop and explode the nuke. Nuke drop triggers in 500ms, 
                    --1 time only. The explosion is triggered at 2700ms which is when the nuke should be hitting 
                    --the ground on the game map, it is also triggered 1 time. 
                    else 
                    activator = getPlayerFromNick ( source ) 
                    showCursor ( source, false ) 
                    --Makes sure the cursor will not show again for detonation unless the nuke is not active. Activator 
                    --is used to display output messages in the other functions that activations/launches arent possible. 
                    end 
        end 
    end 
    addEventHandler ( "onPlayerClick", root, playerClickNuke ) 
      
    --============================================================================================================================= 
    --Move 3 objects according to the beacon/detonation point to give the appearance of a falling nuclear bomb to the desired point 
    --============================================================================================================================= 
    function nukeShot () 
        nuke1 = createObject ( 16340, nuke_beaconx, nuke_beacony, nuke_beaconz + 200 ) 
        nuke2 = createObject ( 3865, nuke_beaconx + 0.072265, nuke_beacony + 0.013731, nuke_beaconz + 196.153122 ) 
        nuke3 = createObject ( 1243, nuke_beaconx + 0.060547, nuke_beacony - 0.017578, nuke_beaconz + 189.075554 ) 
        --The 3 objects that make the nucelar bomb are called nuke1, nuke2, and nuke3. Math is done to piece the 
        --bomb together correctly at any given XYZ detonation coordinates. 
        setObjectRotation ( nuke1, math.deg(3.150001), math.deg(0), math.deg(0.245437) ) 
        setObjectRotation ( nuke2, math.deg(-1.575), math.deg(0), math.deg(1.938950) ) 
        setObjectRotation ( nuke3, math.deg(0), math.deg(0), math.deg(-1.767145) ) 
        --The objects must also be rotated after they are placed in the correct XYZ positions to get the bomb shape 
        --I created in the map editor at any given XYZ beacon/detonation point. 
        shotpath = nuke_beaconz - 200 
        moveObject ( nuke1, 5000, nuke_beaconx, nuke_beacony, shotpath, 0, 0, 259.9 ) --, 259 
        moveObject ( nuke2, 5000, nuke_beaconx + 0.072265, nuke_beacony + 0.013731, shotpath - 3.846878, 0, 0, 259.9 ) 
        moveObject ( nuke3, 5000, nuke_beaconx + 0.060547, nuke_beacony - 0.017578, shotpath - 10.924446, 0, 0, 259.9 ) 
        --To make all 3 pieces of the bomb stay together in the exact same shape, they must descend directly down. 
        --nuke2 and nuke3 drop paths are altered slightly to be directly below their created positions in the air. 
    end 
      
    --============================================================================================================== 
    --Create the imitation of a nuclear explosion 
    --==============================================================================================================       
    function nukeExplosion () 
        if nuke_explosionTimer == 0 then 
        --We set this value when the script started. I do so I can keep looping through this function without 
        --resetting it. 
        setTimer ( nukeExplosion, 170, 35 ) 
        --Trigger this function to initiate 35 times in 170ms intervals. 
        nuke_explosionTimer = 1 
        --Set the explosion timer flag to 1 so it is not done again with the looping (could have been true/false) 
        else 
        nuke_loops = nuke_loops + 1 
        --tells us how many times this function as been run through, which will be 35 in total. 
        r = randInt(1.5, 4.5) 
        --r will serve as our explosion radius. It can be a random value between 1.5 and 4.5 from the center of 
        --the circle. The math for this is below. 
        angleup = randInt(0, 35999)/100 
        --Choose a random angle. A value between 0 and 35999 is divided by 100 because we want 
        --to have 2 random decimal places for as well, rather than just a whole integer. 
        Explosionxcoord = r*math.cos(math.rad(angleup)) + nuke_beaconx 
        Explosionycoord = r*math.sin(math.rad(angleup)) + nuke_beacony 
        --The x and y coordinates of the explosion will occur at a max radius of 4.5 away from the nuke beacon, 
        --in a circular shape. This is a fundamental, simple circle geometry formula. 
            if nuke_loops == 1 then 
            nuke_nukeCloud = nuke_beaconz 
            createExplosion ( Explosionxcoord, Explosionycoord, nuke_nukeCloud, 7 ) 
            elseif nuke_loops == 2 then 
            nuke_nukeCloud = nuke_beaconz + 4 
            createExplosion ( Explosionxcoord, Explosionycoord, nuke_nukeCloud, 7 ) 
            --Up until 20 loops, a pillar of explosions is created with the above. 7 is the explosion type, 
            --which is tied with a couple others as the largest. 7 is a aircraft explosion. 
            elseif nuke_loops > 20 then 
            nuke_cloudRotationAngle = nuke_cloudRotationAngle + 22.5   
                if nuke_explosionLimiter == false then 
                nuke_cloudRadius = 7 
                Explosionxcoord = nuke_cloudRadius*math.cos(math.rad(nuke_cloudRotationAngle)) + nuke_beaconx --recalculate 
                Explosionycoord = nuke_cloudRadius*math.sin(math.rad(nuke_cloudRotationAngle)) + nuke_beacony --recalculate     
                createExplosion ( Explosionxcoord, Explosionycoord, nuke_nukeCloud, 7 ) 
                nuke_explosionLimiter = true 
                elseif nuke_explosionLimiter == true then 
                nuke_explosionLimiter = false 
                end     
            nuke_cloudRadius2 = 16   
            Explosionxcoord2 = nuke_cloudRadius2*math.cos(math.rad(nuke_cloudRotationAngle)) + nuke_beaconx 
            Explosionycoord2 = nuke_cloudRadius2*math.sin(math.rad(nuke_cloudRotationAngle)) + nuke_beacony             
            createExplosion ( Explosionxcoord2, Explosionycoord2, nuke_nukeCloud, 7 ) 
            else 
            nuke_nukeCloud = nuke_nukeCloud + 4 
            createExplosion ( Explosionxcoord, Explosionycoord, nuke_nukeCloud, 7 ) 
            end  
            --Since explosions are pushed to the limit, I have to make sure I can use the maximum amount without 
            --having explosions not appear. This required me to have the above explosions run every other time 
            --to create a mushroom cloud inner part (a circular area defined above), while at the same time creating 
            --an outter circle that also gave the look of a "full" mushroom cloud that won't have obvious visual holes. 
                if nuke_loops == 1 then 
                --On the first loop, the bright flare (as I call it, actually a corona marker), is created and increases in size.   
                nukeExplosionFlare = createMarker ( nuke_beaconx, nuke_beacony, nuke_beaconz, "corona", 0, 255, 255, 255, 255 ) 
                --The flare has an inital size of 0, and the R, G, B colors are 255, making it white.       
                nuke_flareSize = 0 
                setTimer ( nukeFlareGrow, 1, 200 ) 
                --On the first loop, set the nuke_flareSize varible to 0, which will dictate the flare (corona) size 
                --in the nukeFlareGrow function below as it is looped. The timer initiates the function 200 times, 
                --every 1ms (so it takes 1/5 of a second to loop 200 times, thus making the bright flare). 
                elseif nuke_loops == 35 then 
                nuke_explosionTimer = 0 
                setTimer ( nukeFlareFade, 1, 200 ) 
                nuke_loops = 0              
                end 
                    --When this function has looped 35 times, the nuke has finished exploding and the flare must begin 
                    --fading to look like it disappears naturally. Nuke loops is reset for the next nuke launch. 
        end 
    end 
      
    function nukeFlareGrow () 
            setMarkerSize ( nukeExplosionFlare, nuke_flareSize ) 
            nuke_flareSize = nuke_flareSize + 1 
                if nuke_flareSize == 200 then 
                destroyElement ( nuke1 ) 
                destroyElement ( nuke2 ) 
                destroyElement ( nuke3 ) 
                end 
                --The flare becomes +1 larger on each loop, and the nuke is destroyed when the flare reaches maximum 
                --size. It is triggered here as this is the point where it is safest to assume the objects are out of site. 
    end 
      
    function nukeFlareFade () 
        nuke_flareSize = nuke_flareSize - 1 
        setMarkerSize ( nukeExplosionFlare, nuke_flareSize ) 
        if nuke_flareSize == 0 then 
        destroyElement ( nukeExplosionFlare ) 
        nuke_cannonActivated = false 
        end 
        --Each time the function loops, the flare gets -1 smaller. When it has a size of 0 and becomes invisible, it needs 
        --to be deleted for the next nuke launch. No elements should stay created as they will pile up and eventually 
        --crash you or the server. Finally, nuke_cannonActivated is false, meaning the nuke is inactive and another weapon 
        --use can be performed. 
    end 
    

    what is the problem ?

    Thx .

  4. Ok, I will try to better explain:

    i want add in a script something for that there is only me who can use the script I am now talking .

    Example : in the script :

    -- Client file 
      
    -- First off, we need this to track the mouse being on or not 
    mouseon = 0 
      
      
    -- We use functions in order to control the mouse functionality, so we can track our own variables 
    function ActivateMouse() 
        -- We set the mouse to active, and give them a message. 
        mouseon = 1 
        showCursor( true ) 
    --  outputChatBox( "Click to explode somewhere. Press b again to stop." )    
    end 
      
    function DeactivateMouse() 
        -- We hide the mouse, and tell them about it. 
        mouseon = 0 
        showCursor( false ) 
    --  outputChatBox( "Bomb mode deactivated." ) 
    end 
      
    function keydown() 
        -- The key is the bomb one so we'll check whether to activate or deactivate. 
        if ( mouseon == 0 ) then 
            ActivateMouse() 
         
        else 
            DeactivateMouse() 
        end 
    end 
      
    -- Bind the key. 
    --bindKey( "b", "down", keydown ) 
      
    function startup() 
    --  -- At startup, we'll bind the key. 
        outputChatBox( "" ) 
        bindKey( "b", "down", keydown ) 
        outputChatBox( "" ) 
    end 
      
    addEventHandler("onClientResourceStart", getRootElement(), startup) 
      
    function commands( commandName, arg, arg2 ) 
        -- This is like a mastercmd. 
        if( arg == "start" ) then  
            startup() 
             
        elseif( arg == "keydown" ) then 
            keydown() 
            outputChatBox( "key down." )  
             
        elseif( arg == "mouse" ) then 
            if( arg2 == "on" ) then 
                ActivateMouse() 
                outputChatBox( "Mouse activated." ) 
            else  
                DeactivateMouse()  
                outputChatBox( "Mouse deactivated." ) 
            end 
             
        else 
            outputChatBox( "Bomber script is active. (c) tomozj 2008" ) 
            outputChatBox( "USAGE: /bomber [start/keydown/mouse] [on/off]" ) 
        end 
    end 
      
    addCommandHandler("bomber", commands, arg, arg2) 
         
      
    function mousehandler( button, state, absolouteX, absolouteY, worldX, worldY, worldZ ) 
        -- When the mouse is clicked, we'll check the button and if need be, call the server script to create the explosion. 
        if ( state == "down" ) and ( mouseon == 1 ) then 
            triggerServerEvent( "bomb", getRootElement(), worldX, worldY, worldZ, source ) 
            -- Optional message  --  outputChatBox( "Kaboom!" ) 
            DeactivateMouse() 
        end 
    end 
      
    -- We call our mousehandler event when the user clicks the mouse. 
    addEventHandler( "onClientClick", getRootElement(), mousehandler ) 
    

    Everyone can use this script when he is activated ..

    I want that just me can use this script when he is activated !

    Thx .

  5. You do not understand, I would like to know if I can een fair so that only my nickname can use this script.

    And including: how do you make so that only my nickname can be used to script?

    Thx.

  6. Thank you for your answers,

    And therefore I imagine that I only want to use the script, I should add in her ACL :

    ?

    Thx.

    PS: Katalistix, pourquoi tu veut que je mette mon titre en francais ^^ ?

  7. I have wondered whether could ensure that the scripts such as a barrel ion, the script bomber and the other can be used by just 1 nickname mine.

    What is the code was inserted into each script plz?

    IF this is not possible, is what can ensure that only my nickname can use this script:

    -- Client file 
      
    -- First off, we need this to track the mouse being on or not 
    mouseon = 0 
      
      
    -- We use functions in order to control the mouse functionality, so we can track our own variables 
    function ActivateMouse() 
        -- We set the mouse to active, and give them a message. 
        mouseon = 1 
        showCursor( true ) 
    --  outputChatBox( "Click to explode somewhere. Press b again to stop." )    
    end 
      
    function DeactivateMouse() 
        -- We hide the mouse, and tell them about it. 
        mouseon = 0 
        showCursor( false ) 
    --  outputChatBox( "Bomb mode deactivated." ) 
    end 
      
    function keydown() 
        -- The key is the bomb one so we'll check whether to activate or deactivate. 
        if ( mouseon == 0 ) then 
            ActivateMouse() 
         
        else 
            DeactivateMouse() 
        end 
    end 
      
    -- Bind the key. 
    --bindKey( "b", "down", keydown ) 
      
    function startup() 
    --  -- At startup, we'll bind the key. 
        outputChatBox( "Startup." ) 
        bindKey( "b", "down", keydown ) 
        outputChatBox( "Key binded. Press b to start bomber mode, and click to explode." ) 
    end 
      
    addEventHandler("onClientResourceStart", getRootElement(), startup) 
      
    function commands( commandName, arg, arg2 ) 
        -- This is like a mastercmd. 
        if( arg == "start" ) then  
            startup() 
             
        elseif( arg == "keydown" ) then 
            keydown() 
            outputChatBox( "key down." )  
             
        elseif( arg == "mouse" ) then 
            if( arg2 == "on" ) then 
                ActivateMouse() 
                outputChatBox( "Mouse activated." ) 
            else  
                DeactivateMouse()  
                outputChatBox( "Mouse deactivated." ) 
            end 
             
        else 
            outputChatBox( "Bomber script is active. (c) tomozj 2008" ) 
            outputChatBox( "USAGE: /bomber [start/keydown/mouse] [on/off]" ) 
        end 
    end 
      
    addCommandHandler("bomber", commands, arg, arg2) 
         
      
    function mousehandler( button, state, absolouteX, absolouteY, worldX, worldY, worldZ ) 
        -- When the mouse is clicked, we'll check the button and if need be, call the server script to create the explosion. 
        if ( state == "down" ) and ( mouseon == 1 ) then 
            triggerServerEvent( "bomb", getRootElement(), worldX, worldY, worldZ, source ) 
            -- Optional message  --  outputChatBox( "Kaboom!" ) 
            DeactivateMouse() 
        end 
    end 
      
    -- We call our mousehandler event when the user clicks the mouse. 
    addEventHandler( "onClientClick", getRootElement(), mousehandler ) 
    

    Thx .

×
×
  • Create New...