Jump to content

Mark0

Members
  • Posts

    89
  • Joined

  • Last visited

Posts posted by Mark0

  1. new problem when i take the skin the windows hide but the cursor no and when i press close only the cursor hide

    local marker = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
    local marker2 = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
      
    local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
      
    function createskinGui () 
    window = guiCreateWindow(0.29,0.2117,0.3512,0.675,"police skins",true) 
    skinsgrid = guiCreateGridList(0.0391,0.0938,0.9217,0.6222,true,window) 
    guiGridListSetSelectionMode(skinsgrid,2) 
      
    _skins = guiGridListAddColumn(skinsgrid,"Skins",0.-- s8) -->
    skibtn = guiCreateButton(0.242,0.7432,0.5338,0.0617,"take skin",true,window) 
    closebtn = guiCreateButton(0.2456,0.8519,0.5302,0.0568,"Close",true,window) 
    for index, skin in ipairs(skins) do 
            local row = guiGridListAddRow (skinsgrid) 
            guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
        end 
    end  
      
    addEventHandler ( "onClientMarkerHit", marker, 
        function ( hitElement ) 
            if ( hitElement == localPlayer ) then 
                    createskinGui ( hitElement ) 
                    if ( window ~= nil ) then 
                        guiSetVisible ( window, true ) 
                        showCursor ( true ) 
                        guiSetInputEnabled ( true ) 
                    end 
            end 
        end 
    ) 
      
    addEventHandler("onClientGUIClick", root,  
    function () 
            if (source == skibtn) then 
                local row,col = guiGridListGetSelectedItem(skinsgrid) 
                if (row and col and row ~= -1 and col ~= -1) then 
                    local skinName = guiGridListGetItemText(skinsgrid, row, 1) 
                    if skinName == "police 1" then 
                        setElementModel(getLocalPlayer(), 280) 
                    elseif skinName == "police 2" then 
                        setElementModel(getLocalPlayer(),281) 
                        elseif skinName == "police 3" then 
                            setElementModel(getLocalPlayer(), 282) 
                            elseif skinName == "police 4" then 
                                setElementModel(getLocalPlayer(), 283) 
                                elseif skinName == "police 5" then 
                                    setElementModel(getLocalPlayer(),284) 
                                    elseif skinName == "police 6" then 
                                     setElementModel(getLocalPlayer(), 288)                              
                        end 
                         
    guiSetVisible(window, false) 
    showCursor(false) 
                             
                else 
                    outputChatBox("Please,select a skin of the list.",255,0,0) 
                end 
                elseif (source == closebtn) then 
                    triggerEvent("closeWindow", root ) 
            end 
    end 
    ) 
      
      
    addEventHandler("onClientMarkerLeave", marker, 
    function () 
            triggerEvent("closeWindow", root ) 
    end 
    ) 
      
    addEvent("closeWindow", true) 
    addEventHandler("closeWindow", root,  
    function () 
                guiSetVisible(windows, false) 
                showCursor(false) 
                guiSetInputEnabled(false) 
    end 
    ) 
    

  2. No skins and no cursor

    local marker = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
    local marker2 = createMarker (1543.0826416016,-1678.3455810547,12.5,"cylinder",2,0,255,0,255) 
      
    local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
      
    function createskinGui () 
    window = guiCreateWindow(0.29,0.2117,0.3512,0.675,"police skins",true) 
    skinsgrid = guiCreateGridList(0.0391,0.0938,0.9217,0.6222,true,window) 
    guiGridListSetSelectionMode(skinsgrid,2) 
      
    _skins = guiGridListAddColumn(skinsgrid,"Skins",0.2) 
    skibtn = guiCreateButton(0.242,0.7432,0.5338,0.0617,"take skin",true,window) 
    closebtn = guiCreateButton(0.2456,0.8519,0.5302,0.0568,"Close",true,window) 
    for index, skin in ipairs(vehicles) do 
            local row = guiGridListAddRow (skinsgrid) 
            guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
        end 
    end  
      
    addEventHandler ( "onClientMarkerHit", marker, 
        function ( hitElement ) 
            if ( hitElement == localPlayer ) then 
                    createskinGui ( hitElement ) 
                    if ( window ~= nil ) then 
                        guiSetVisible ( window, true ) 
                        showCursor ( true ) 
                        guiSetInputEnabled ( true ) 
                    end 
            end 
        end 
    ) 
      
    addEventHandler ( "onClientMarkerHit", marker2, 
        function ( hitElement ) 
            if ( hitElement == localPlayer ) then 
                    createskinGui ( hitElement ) 
                    if ( window ~= nil ) then 
                        guiSetVisible ( window, true ) 
                        showCursor ( true ) 
                        guiSetInputEnabled ( true ) 
                    end 
            end 
        end 
    ) 
      
    addEventHandler("onClientGUIClick", root,  
    function () 
            if (source == skibtn) then 
                local row,col = guiGridListGetSelectedItem(skinsgrid) 
                if (row and col and row ~= -1 and col ~= -1) then 
                    local vehicleName = guiGridListGetItemText(skinsgrid, row, 1) 
                    if skinName == "police 1" then 
                        setElementModel(getLocalPlayer(), 280) 
                    elseif skinName == "police 2" then 
                        setElementModel(getLocalPlayer(),281) 
                        elseif skinName == "police 3" then 
                            setElementModel(getLocalPlayer(), 282) 
                            elseif skinName == "police 4" then 
                                setElementModel(getLocalPlayer(), 283) 
                                elseif skinName == "police 5" then 
                                    setElementModel(getLocalPlayer(),284) 
                                    elseif skinName == "police 6" then 
                                     setElementModel(getLocalPlayer(), 288)                              
                        end 
                             
                else 
                    outputChatBox("Please,select a skin of the list.",255,0,0) 
                end 
                elseif (source == closebtn) then 
                    triggerEvent("closeWindow", root ) 
            end 
    end 
    ) 
      
      
    addEventHandler("onClientMarkerLeave", marker, 
    function () 
            triggerEvent("closeWindow", root ) 
    end 
    ) 
      
    addEventHandler("onClientMarkerLeave", marker2, 
    function () 
            triggerEvent("closeWindow", root ) 
    end 
    ) 
      
      
    addEvent("closeWindow", true) 
    addEventHandler("closeWindow", root,  
    function () 
                guiSetVisible(windows, false) 
                showCursor(false) 
                guiSetInputEnabled(false) 
    end 
    ) 
    

  3. i create this but don't work

    checkGateMarker = createMarker ( 216.22926330566, 1875.0806884766, 7.4616560935974, "corona", 10.0, 0, 0, 255, 0 ) 
    function onPoliceShapeHit ( thePlayer, matchingDimension ) 
        if ( getElementType ( thePlayer ) == "player" ) then 
            outputChatBox ( "You have entered Police Base zone!", thePlayer, 0, 0, 255 ) 
        end 
    end 
    addEventHandler ( "onColShapeHit", policeColShape, onPoliceShapeHit ) 
      
    function show() 
    if getPlayerTeam(getLocalPlayer()) == getTeamFromName("Medic") then 
    moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) 
    end 
    end 
    addEventHandler ( "onMarkerHit", checkGateMarker, onLeave ) 
    function createGate () 
        gatePolice = createObject ( 976, 209.8828125, 1875.8419189453, 12.372331619263 ) 
    end 
    addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) 
      
      
    function gateCheckingTeam ( thePlayer, matchingDimension ) 
        moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) 
    end 
    addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) 
      
    function onLeave ( thePlayer, matchingDimension ) 
        setTimer ( movingBackPolice, 3000, 1, thePlayer ) 
    end 
    addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) 
      
    function movingBackPolice () 
        moveObject ( gatePolice, 3000, 209.8828125, 1875.8419189453, 12.372331619263 ) 
    end 
      
    

  4. for you it's not hard but for me yes i'm learner

    @ samer insade the script i will understand it but like this i can't there is some words not needed om my script

    getPlayerTeam 
    

  5. how to set that gate open only for Ex: Swat

    checkGateMarker = createMarker ( 216.22926330566, 1875.0806884766, 7.4616560935974, "corona", 10.0, 0, 0, 255, 0 ) 
    function onPoliceShapeHit ( thePlayer, matchingDimension ) 
        if ( getElementType ( thePlayer ) == "player" ) then 
            outputChatBox ( "You have entered Police Base zone!", thePlayer, 0, 0, 255 ) 
        end 
    end 
    addEventHandler ( "onColShapeHit", policeColShape, onPoliceShapeHit ) 
      
    function createGate () 
        gatePolice = createObject ( 976, 209.8828125, 1875.8419189453, 12.372331619263 ) 
    end 
    addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) 
      
      
    function gateCheckingTeam ( thePlayer, matchingDimension ) 
        moveObject ( gatePolice, 976, 218.11740112305, 1875.3406982422, 12.372331619263 ) 
    end 
    addEventHandler ( "onMarkerHit", checkGateMarker, gateCheckingTeam ) 
      
    function onLeave ( thePlayer, matchingDimension ) 
        setTimer ( movingBackPolice, 3000, 1, thePlayer ) 
    end 
    addEventHandler ( "onMarkerLeave", checkGateMarker, onLeave ) 
      
    function movingBackPolice () 
        moveObject ( gatePolice, 3000, 209.8828125, 1875.8419189453, 12.372331619263 ) 
    end 
      
    

  6. why blip color don't change ??

      
    blip = ( 1954.3000488281, -2174.5, 12.5, 22 ) 
    blips = getElementsByType ( "blip" ) 
    for blipKey, blipValue in ipairs(createBlip) do 
        red, green, blue, alpha = getBlipColor ( blipValue ) 
        if ( red ~= 255 or green ~= 255 or blue ~= 255 or alpha ~= 255 ) then 
            setBlipColor ( blipValue, 255, 150, 0, 255 ) 
        end 
    end 
      
    

  7. i add it like you say but i can't see the marker and i can take the car

    createBlip(2035.1999511719, -1406.5, 16.200000762939, 22) 
    MedicTeam = createTeam ("Medic", 0, 255, 255) 
    ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
    setElementVisibleTo(ambulancee, root, false)   
      
    function joinMedic() 
         setPlayerTeam(source,MedicTeam) 
         setPlayerNametagColor ( thePlayer, 0, 255, 255 ) 
         setElementVisibleTo(ambulancee, source, true)   
         setElementModel(source,276) 
         giveWeapon(source, 41, 999) 
         setElementData(source, "Occupation", "Medic") 
         outputChatBox("You are now Medic.", source, 0,255,0) 
    end 
    addEvent("setMedic", true) 
    addEventHandler("setMedic",root,joinMedic) 
    addCommandHandler ( "nametagcolor", nametagColorChange ) 
      
    function leaveMedic() 
            if isElementVisibleTo(ambulancee, source) then 
               setElementVisibleTo(ambulancee, source, false)  
            end 
    end 
    addEventHandler("setMedic",root,leaveMedic) 
      
    addEvent("medic:healing", true) 
    addEventHandler("medic:healing", root, 
    function (medic) 
        if (getElementHealth(source) < 100) then 
            local Heal = getElementHealth(source) + 10 
            setElementHealth(source, Heal) 
            if (Heal > 100) then 
                 setElementHealth(source, 100) 
            end 
            givePlayerMoney(medic, 100) 
            takePlayerMoney(source, 100) 
        end 
    end) 
      
    local jobVehicles = {} 
      
    addEventHandler("onMarkerHit", ambulancee, 
    function(hitElement) 
         if (getElementType(hitElement) ~= "player") then return end 
         local x, y, z = getElementPosition(hitElement) 
         local team = getPlayerTeam(hitElement) 
         if(isPedInVehicle(hitElement)) then return end 
         if (isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
         if (team and getTeamName(team) == "Medic") then 
              jobVehicles[hitElement] = createVehicle(416, x, y, z, 0, 0, 180) 
              setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) 
         end 
    end) 
    

  8. How to show my marker only for Medics

      
    createBlip ( 2035.1999511719, -1406.5, 16.200000762939, 22 ) 
      
    function createMedicTeam () 
        MedicTeam = createTeam ("Medic", 6, 183, 248) 
    end 
    addEventHandler ("onResourceStart", resourceRoot, createMedicTeam) 
      
    function joinMedic() 
         setPlayerTeam(source,MedicTeam) 
         setElementModel(source,276) 
          giveWeapon ( source, 41, 999 ) 
         setElementData( source, "Occupation", "Medic", true ) 
         outputChatBox("You are now Medic.",source,0,255,0) 
    end 
    addEvent("setMedic", true) 
    addEventHandler("setMedic",root,joinMedic) 
    addEvent("medic:healing", true) 
    addEventHandler("medic:healing", root, 
    function (medic) 
        if (getElementHealth(source) < 100) then 
            local Heal = getElementHealth(source) + 10  
            setElementHealth(source, Heal)  
            if (Heal > 100) then 
                 setElementHealth(source, 100) 
            end 
            givePlayerMoney(medic, 100)  
            takePlayerMoney(source, 100)  
        end 
    end) 
      
    ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
    setElementVisibleTo(ambulancee, Medic, false) 
      
    local jobVehicles = {} 
      
    addEventHandler("onMarkerHit", ambulancee, 
        function(hitElement)  
            if (getElementType(hitElement) ~= "player") then return end 
            local x, y, z = getElementPosition(hitElement)  
            local team = getPlayerTeam(hitElement)  
            if(isPedInVehicle(hitElement)) then return end 
            if (jobVehicles[hitElement] and isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
            if (team and getTeamName(team) == "Medic") then 
                                    setElementVisibleTo(ambulancee, root, true)    
                jobVehicles[hitElement] = createVehicle (416, x, y, z, 0, 0, -90)  
                setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement])  
            end 
    end 
    )  
    

  9. Sorry it's not my post but i have a question how to add carspowner when you take the job ( only medics can see them ) ?

    This depends on the car spawner, it will be a marker?

    You can easily make the marker visible only to medics, but again it depends on how you will get these medics, is they are team? gang? ACL group?

    You can use

    setElementVisibleTo 
    

    or you can use IF statement to make the marker show the gui only for medics, whatever they were a team or gang or ACL group.

    Yes rights it will be a marker when he take medic job he can see the marker( car medic spowner)

    i can use this code but how to change someguy to medic team ???

    local someguy = getPlayerFromName ( "someguy" ) 
    if ( someguy ) then 
        x, y, z = getElementPosition ( someguy ) 
        myMarker = createMarker ( x, y, z ) 
        setElementVisibleTo ( myMarker, getRootElement ( ), false ) 
        setElementVisibleTo ( myMarker, someguy, true ) 
    end 
    

    and for hide the marker too

    local someguy = getPlayerFromName ( "someguy" ) 
    local anotherguy = getPlayerFromName ( "anotherguy" )  
    if ( someguy ) then 
        x, y, z = getElementPosition ( someguy ) 
        myMarker = createMarker ( x, y, z ) 
        setElementVisibleTo ( myMarker, anotherguy, true ) 
        setElementVisibleTo ( myMarker, anotherguy, false ) 
    end 
    

    and if like you say i can use If is this right ?

    function joinTeam() 
             triggerServerEvent("setMedic",localPlayer) 
             guiSetVisible(windowjob, false) 
             showCursor(false) 
             showMarker(true) --------like this ??----------- 
        end 
    

    or should i add it in this function ?

        addEventHandler("onClientPlayerDamage", localPlayer, 
    function(attacker, weapon, bodypart, loss) 
    team = getPlayerTeam(attacker) 
        if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Medic") then  
            cancelEvent() -- Cancels the damage cause by the spray 
            if (not isTimer(pause)) then  
                local health = getElementHealth(localPlayer) 
                if (health < 99) then 
                triggerServerEvent("medic:healing", localPlayer, attacker)  
                pause = setTimer(function() end, 1000, 1) - 
                end 
            end 
        end 
    end) 
    

    Ty :)

  10. ok ty i see this function when i download a script from community it's is necessary ?

    function open_log_reg_pannel() 
    if not(isElement(Login_Pannel)) then 
         
        if blackLoginScreen == true then 
            fadeCamera(false,0,0,0,0) 
        end 
        ------------ Window Gui------------- 
     end 
      
    

  11. there alrready exsist much login panels in comunity. check some codes maybe could help you

    You should promote people doing their own scripts, and not using elses.

    you are right, but if he is starter with script he can see other scripts to see how work some functions and how use it

    yes i download some login panel scripters but i don't understand all the scripter so i like to create my own script so can you say how ??????

×
×
  • Create New...