Jump to content

ramzi

Members
  • Posts

    90
  • Joined

  • Last visited

Posts posted by ramzi

  1. Hi guys,i've over here my Headshot script which works only with team"Admins",the problem is that i tried to add 2 more teams using "and" but i failed :? ,Plz help me out!here is the script:

      
    addEvent "onPlayerHeadshot" 
    addEventHandler("onPlayerDamage", getRootElement(), 
        function (attacker, weapon, bodypart, loss) 
        if getElementType ( attacker ) == "player" then 
            if bodypart == 9 and weapon == 34 then 
                local HSteam = getPlayerTeam(attacker) 
                if HSteam and getTeamName(HSteam)=="Admins" then       
                    local result = triggerEvent("onPlayerHeadshot",source, attacker, weapon, loss) 
                    if result == true then                      
                      killPed(source, attacker, weapon, bodypart) 
                      setPedHeadless( source, true )                
                      addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) 
                    end               
                end         
            end                                     
        end 
        end  
    ) 
        function BackUp( source )   
        if getElementType ( source ) == "player" then 
            setPedHeadless ( source, false ) 
        end 
    end 
      
    

  2. Basically, now you have just to define the cordinations x,y,z , roation, add your team name if needed else remove this part and others like object ..etc

    click on the functions to read more about them in the wiki.

    local gate1 = createObject (Gate ID, x,y,z, rx,ry,rz ) 
    local gatecol =  createColCircle (x, y, z)----Put here the new dimensions u move ur gate to. 
    local teamName = "Your Team name here" 
                        
    function OpenGates (thePlayer) 
        if ( getTeamName(getPlayerTeam(thePlayer)) == teamName ) then 
            moveObject (gate1,2000,x,y, z ) 
        end 
    end 
    addEventHandler( "onColShapeHit", gatecol, OpenGates ) 
                  
    function CloseGates (thePlayer) 
        if ( getTeamName(getPlayerTeam(thePlayer)) == teamName ) then 
            moveObject (gate1,2000,x, y, z )---Put here the original position of ur gate before it moves. 
        end 
    end 
    addEventHandler( "onColShapeLeave", gatecol, CloseGates ) 
    

    Great,it has no errors now

  3. Basically, now you have just to define the cordinations x,y,z , roation, add your team name if needed else remove this part and others like object ..etc

    click on the functions to read more about them in the wiki.

    local gate1 = createObject (Gate ID, x,y,z, rx,ry,rz ) 
    local gatecol =  createColCircle (x, y, z)----Put here the new dimensions u move ur gate to. 
    local teamName = "Your Team name here" 
                        
    function OpenGates (thePlayer) 
        if ( getTeamName(getPlayerTeam(thePlayer)) == teamName ) then 
            moveObject (gate1,2000,x,y, z ) 
        end 
    end 
    addEventHandler( "onColShapeHit", gatecol, OpenGates ) 
                  
    function CloseGates (thePlayer) 
        if ( getTeamName(getPlayerTeam(thePlayer)) == teamName ) then 
            moveObject (gate1,2000,x, y, z )---Put here the original position of ur gate before it moves. 
        end 
    end 
    addEventHandler( "onColShapeLeave", gatecol, CloseGates ) 
    

    Great,it has no errors now

  4. You want it for all or with groups or with teams ?

    I just answered him that he defined the team name in a variable named 'teamName' and he didn't use it at all

    what function should i change "teamName" to?Cuz script is w

  5. You want it for all or with groups or with teams ?

    I just answered him that he defined the team name in a variable named 'teamName' and he didn't use it at all

    what function should i change "teamName" to?Cuz script is w

  6. gate1 = createObject (Gate ID, x,y,z, rx,ry,rz ) 
        gatecol =  createColCircle (x, y,z)----Put here the new dimensions u move ur gate to. 
        local teamName = "Your Team name here" 
                        
    function OpenGates (thePlayer) 
    if ( getTeamName(getPlayerTeam(thePlayer)) == "Your Team name here" ) then 
        moveObject (gate1,2000,x,y, z ) 
        end 
        end 
        addEventHandler( "onColShapeHit", gatecol, OpenGates ) 
                  
    function CloseGates (thePlayer) 
    if ( getTeamName(getPlayerTeam(thePlayer)) == "Your Team name here" ) then 
        moveObject (gate1,2000,x, y,z )---Put here the original position of ur gate before it moves. 
        end 
        end 
        addEventHandler( "onColShapeLeave", gatecol, CloseGates ) 
    

    This is a simple gate code i've made months ago.Post here anything u dont understand from above.

  7. gate1 = createObject (Gate ID, x,y,z, rx,ry,rz ) 
        gatecol =  createColCircle (x, y,z)----Put here the new dimensions u move ur gate to. 
        local teamName = "Your Team name here" 
                        
    function OpenGates (thePlayer) 
    if ( getTeamName(getPlayerTeam(thePlayer)) == "Your Team name here" ) then 
        moveObject (gate1,2000,x,y, z ) 
        end 
        end 
        addEventHandler( "onColShapeHit", gatecol, OpenGates ) 
                  
    function CloseGates (thePlayer) 
    if ( getTeamName(getPlayerTeam(thePlayer)) == "Your Team name here" ) then 
        moveObject (gate1,2000,x, y,z )---Put here the original position of ur gate before it moves. 
        end 
        end 
        addEventHandler( "onColShapeLeave", gatecol, CloseGates ) 
    

    This is a simple gate code i've made months ago.Post here anything u dont understand from above.

  8. addEvent "onPlayerHeadshot" 
    addEventHandler("onPlayerDamage", getRootElement(), 
        function (attacker, weapon, bodypart, loss) 
            if bodypart == 9 and weapon == 34 then 
                local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) 
                if result == true then 
                    killPed(source, attacker, weapon, bodypart) 
                    setPedHeadless( source, true ) 
                    addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) 
                end 
            end 
        end 
    ) 
        function BackUp( source )    
        if getElementType ( source ) == "player" then 
            setPedHeadless ( source, false ) 
        end 
    end 
    

    I did like this and it stills not working.

  9. Hi guys,i have over here a simple headshot script which i've downloaded from the community:

    addEvent "onPlayerHeadshot" 
    addEventHandler("onPlayerDamage", getRootElement(), 
        function (attacker, weapon, bodypart, loss) 
            if bodypart == 9 and weapon == 34 then 
                local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) 
                if result == true then 
                    killPed(source, attacker, weapon, bodypart) 
                    setPedHeadless( source, true ) 
                    setTimer( BackUp, 900, 1, source ) 
                end 
            end 
        end 
    ) 
        function BackUp( source )    
        if getElementType ( source ) == "player" then 
            setPedHeadless ( source, false ) 
        end 
    end 
    

    The problem is that i want the "part 9" to be taken off becuase when i shoot the head,the player dies but the head still in its place ,thank you.

  10. Here it is:

        --[[ 
        +---------------------------------------------------------------------------- 
        | =================== Script made by Jasper~ =================== | 
        | Please, respect my work -> do not remove the copyrights. 
        | This script took me 45 minutes of my wonderfull life 
        | Bugs/Suggestions? Add me on skype! 
        +----------------------------------------------------------------------------- 
        ]]-- 
          
          
        function lock_newvehicles(player, seat, jacked) 
        if isPedOnGround(player) == true then 
        if getElementData(source, "whoLocked") == "team" then 
        local lock = getElementData(source, "lockedTo") 
        if seat == 0 then 
        if getTeamName(getPlayerTeam(player)) == lock then 
        return true 
        else 
        cancelEvent()exports.DZcommands:sendClientMessage("This vehicle is locked for the following team(s): "..lock..".", player, 255, 255, 255) 
        end 
        end 
        elseif getElementData(source, "whoLocked") == "class" then 
        local lock = getElementData(source, "lockedTo") 
        if seat == 0 then 
        if getElementData(player, "class") == lock then 
        return true 
        else 
        cancelEvent() 
        exports.DZcommands:sendClientMessage("This vehicle is locked for the following class(es): "..lock..".", player, 255, 255, 255) 
        end 
        end 
        elseif getElementData(source, "whoLocked") == "account" then 
        local lock = getElementData(source, "lockedTo") 
        local accName = getAccountName(getPlayerAccount(player)) 
        if seat == 0 then 
        if accName == lock then 
        return true 
        else 
        cancelEvent() 
        exports.DZcommands:sendClientMessage("This vehicle is locked and belongs to the following user(s): "..lock..".", player, 255, 255, 255) 
        end 
        end 
        elseif getElementData(source, "whoLocked") == "acl" then 
        local lock = getElementData(source, "lockedTo") 
        local accName = getAccountName(getPlayerAccount(player)) 
        if seat == 0 then 
        if isObjectInACLGroup("user."..accName, aclGetGroup(lock)) then 
        return true 
        else 
        cancelEvent() 
        exports.DZcommands:sendClientMessage("This vehicle is locked for the following group(s): "..lock..".", player, 255, 255, 255) 
        end 
        end 
        end 
        end 
        end 
        addEventHandler("onVehicleStartEnter", getRootElement(), lock_newvehicles) 
          
          
        function add_new_vehicle (source, command, whoLock, ...) 
        local accName = getAccountName(getPlayerAccount(source)) 
        if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        if isPedInVehicle(source) == true then 
        if not isPedDead(source) == true then 
        local newlock = whoLock 
        if newlock == "team" or newlock == "class" or newlock == "acl" or newlock == "account" then 
        if #arg > 0 then 
        local occupiedVeh = getPedOccupiedVehicle(source) 
        local model = getElementModel(occupiedVeh) 
        local x,y,z = getElementPosition(occupiedVeh) 
        local rx,ry,rz = getElementRotation(occupiedVeh) 
        local lock = table.concat(arg, " ") 
        local groupLock = whoLock 
        local r1, g1, b1, r2, g2, b2 = getVehicleColor(occupiedVeh, true) 
        local color = tostring(r1.. "," ..g1.. "," ..b1.. "," ..r2.. "," ..g2.. "," ..b2) 
        local addVeh = executeSQLQuery("INSERT INTO newprivatevehicles (Model,X,Y,Z,RX,RY,RZ,LOCK,GROUPLOCK,Color) VALUES(?,?,?,?,?,?,?,?,?,?)", tonumber(model), tonumber(x), tonumber(y), tonumber(z), tonumber(rx), tonumber(ry), tonumber(rz), lock, groupLock, tostring(color)) 
        exports.DZcommands:sendClientMessage("Vehicle successfuly created, info: "..groupLock.." - "..lock..".", source, 0,255,0) 
        local newVehicle = createVehicle (tonumber(model),tonumber(x),tonumber(y),tonumber(z), tonumber(rx), tonumber(ry), tonumber(rz)) 
        setElementData(newVehicle, "lockedTo", lock) 
        setElementData(newVehicle, "whoLocked", whoLock) 
        setVehicleColor (newVehicle, tonumber(r1), tonumber(g1), tonumber(b1), tonumber(r2), tonumber(g2), tonumber(b2)) 
        warpPedIntoVehicle(source, newVehicle) 
        else 
        exports.DZcommands:sendClientMessage("Wrong command usage, try '/addveh '.", source, 255, 255, 255) 
        end 
        else 
        exports.DZcommands:sendClientMessage("Wrong command usage, try '/addveh '.", source, 255, 255, 255) 
        end 
        exports.DZcommands:sendClientMessage("You are dead, respawn to make this vehicle!", source, 255, 255, 255) 
        end 
        elseexports.DZcommands:sendClientMessage("You are not in a vehicle, go in a vehicle to create one!", source, 255, 255, 255) 
        end 
        end 
        end 
        addCommandHandler("addveh", add_new_vehicle) 
          
        -- remove function 
          
        function remove_lockedvehicle (source) 
        local accName = getAccountName(getPlayerAccount(source)) 
        if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then 
        local vehicle = getPedOccupiedVehicle(source) 
        local lock = getElementData(vehicle, "lockedTo") 
            if isPedInVehicle(source) == true then 
                if getElementData(vehicle, "lockedTo") ~= "" then 
                        executeSQLQuery("DELETE FROM newprivatevehicles WHERE LOCK=?", lock) 
                         destroyElement(vehicle) 
                          exports.DZcommands:sendClientMessage("Vehicle has successfully been removed from the database.", source, 255, 255, 255) 
                        else 
                           exports.DZcommands:sendClientMessage("* This is not a private vehicle, take another vehicle!", source, 255, 255, 255) 
                end 
                     else 
                exports.DZcommands:sendClientMessage("* You must be in a vehicle in order to remove this vehicle.", source, 255, 255, 255) 
            end 
        end 
        end 
        addCommandHandler("remveh", remove_lockedvehicle) 
          
                
            addEventHandler("onVehicleExplode",root, 
                        function () 
                            setTimer ( 
                                function ( vehicleID, vehicle ) 
                                    if ( vehicleID and type ( vehicleID ) == "number" ) then 
                                        table.remove(vehicles, vehicleID) 
                                        if isElement( vehicle ) then 
                                            destroyElement ( vehicle ) 
                                        end 
                                      executeSQLQuery("CREATE TABLE IF NOT EXISTS newprivatevehicles (Model NUMERIC, X NUMBERIC, Y NUMERIC, Z NUMERIC, RX NUMERIC, RY NUMERIC, RZ NUMERIC, LOCK TEXT, GROUPLOCK TEXT, Color TEXT)") 
                                        fixVehicle(model, x, y, z, rot, color, upgrades, dataType, allowedTo) 
                                    end 
                                end 
                            ,10000, 1, #vehicles, source ) 
                    return vehicle 
        end 
        ) 
          
    

  11. Well bodypart of the blown vehicles respwned,but the vehicles itself didnt respawn and i got another error:

    ERROR: sqlvehicles\vehicles_usefulserver.lua:130: attempt to call global 'createPrivateVehicle' (a nil value)

×
×
  • Create New...