Jump to content

Mark0

Members
  • Posts

    89
  • Joined

  • Last visited

Posts posted by Mark0

  1. i have problems at join team too

    100:bad argument @'addEventHandler' [expected element ar argument 2,got nil ]

    94:bad argument @'addEventHandler' [expected element ar argument 2,got nil ]

    local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "Cylinder", 1.5, 0, 0, 255, 150) 
    local marker1 = createMarker( 2241.8999023438, 2435.8999023438, 9.8000001907349, "Cylinder", 1.5, 0, 0, 255, 150) 
    local marker2 = createMarker( -2129, -2481.3999023438, 29.60000038147, "Cylinder", 1.5, 0, 0, 255, 150) 
    local marker3 = createMarker( -1616.9000244141, 681, 6.0999999046326, "Cylinder", 1.5, 0, 0, 255, 150)   
    local marker4 = createMarker( -216.5, 978, 18.5, "Cylinder", 1.5, 0, 0, 255, 150) 
         
    local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
         
    function createskinGui()     
    windowjob = guiCreateWindow(0.335,0.14,0.3963,0.6817,"Police job",true) 
    infomemo = guiCreateMemo(0.0347,0.0611,0.9369,0.3667,"Job information",true,windowjob) 
    skinsgrid = guiCreateGridList(0.0347,0.4841,0.9369,0.313,true,windowjob) 
    guiGridListSetSelectionMode(skinsgrid,2) 
    _skins = guiGridListAddColumn(skinsgrid,"Skins",0.-- s8) -->
    takebtn = guiCreateButton(0.2492,0.8289,0.5047,0.0562,"Take Job",true,windowjob) 
    Closebtn = guiCreateButton(0.2492,0.9095,0.5047,0.0562,"Close",true,windowjob) 
    infolbl = guiCreateLabel(0.2681,0.4279,0.4637,0.0538,"Choose your skin :",true,windowjob) 
    guiLabelSetColor(infolbl,0,0,255) 
    guiLabelSetVerticalAlign(infolbl,"center") 
    guiLabelSetHorizontalAlign(infolbl,"center",false) 
    guiSetFont(infolbl,"default-bold-small") 
    for index, skin in ipairs(skins) do 
            local row = guiGridListAddRow (skinsgrid) 
            guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
    end 
    showCursor(true) 
    end  
      
    addEventHandler("onClientGUIClick", root, 
    function () 
            if (source == takebtn) 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 
                        triggerEvent("closeWindow", localPlayer ) 
                else 
                    outputChatBox("Please,select a skin of the list.",255,0,0) 
                end 
                elseif (source == closebtn) then 
                 triggerEvent("closeWindow", localPlayer ) 
            end 
    end 
    ) 
      
    function SAPDjob( hitElement ) 
            if ( hitElement == localPlayer ) then 
                    createskinGui ( hitElement ) 
                    if ( windowjob ~= nil ) then 
                        guiSetVisible ( windowjob, true ) 
                        showCursor ( true ) 
                        guiSetInputEnabled ( true ) 
                    end 
            end 
    end 
            addEventHandler("onClientMarkerHit", marker, SAPDjob) 
            addEventHandler("onClientMarkerHit", marker1, SAPDjob) 
            addEventHandler("onClientMarkerHit", marker2, SAPDjob) 
            addEventHandler("onClientMarkerHit", marker3, SAPDjob) 
            addEventHandler("onClientMarkerHit", marker4, SAPDjob) 
              
            function SAPDjobleave(leaveElement) 
                 if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                      if guiGetVisible(windowjob) then 
                           guiSetVisible(windowjob, false) 
                           showCursor(false) 
                            
                      end 
                 end 
            end 
            addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) 
            addEventHandler("onClientMarkerLeave", marker1, SAPDjobleave) 
            addEventHandler("onClientMarkerLeave", marker2, SAPDjobleave) 
            addEventHandler("onClientMarkerLeave", marker3, SAPDjobleave) 
            addEventHandler("onClientMarkerLeave", marker4, SAPDjobleave) 
              
            function joinTeam() 
                 triggerServerEvent("setSAPD",localPlayer) 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientGUIClick", takebtn , joinTeam, false) 
              
            function removeSAPDWindow() 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientGUIClick", Closebtn , removeSAPDWindow, false) 
        
    

  2. Yeah you are right i forget the table ty

    local skins = {"police 1", "police 2", "police 3", "police 4", "police 5", "police 6"} 
    

  3. so this is not the table ??

    addEventHandler("onClientGUIClick", root, 
    function () 
            if (source == takebtn) 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)                             
                        end 
                else 
                    outputChatBox("Please,select a skin of the list.",255,0,0) 
                end 
                elseif (source == closebtn) then 
                 triggerEvent("closeWindow", localPlayer ) 
            end 
    end 
    ) 
    

  4. so;e help guys

    bad argument #1 to 'ipairs' (table expected,got nil)

    local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "Cylinder", 1.5, 0, 0, 255, 150) 
         
    function createskinGui()     
    windowjob = guiCreateWindow(0.335,0.14,0.3963,0.6817,"Police job",true) 
    infomemo = guiCreateMemo(0.0347,0.0611,0.9369,0.3667,"Job information",true,windowjob) 
    skinsgrid = guiCreateGridList(0.0347,0.4841,0.9369,0.313,true,windowjob) 
    guiGridListSetSelectionMode(skinsgrid,2) 
    _skins = guiGridListAddColumn(skinsgrid,"Skins",0.-- s8) -->
    takebtn = guiCreateButton(0.2492,0.8289,0.5047,0.0562,"Take Job",true,windowjob) 
    Closebtn = guiCreateButton(0.2492,0.9095,0.5047,0.0562,"Close",true,windowjob) 
    infolbl = guiCreateLabel(0.2681,0.4279,0.4637,0.0538,"Choose your skin :",true,windowjob) 
    guiLabelSetColor(infolbl,0,0,255) 
    guiLabelSetVerticalAlign(infolbl,"center") 
    guiLabelSetHorizontalAlign(infolbl,"center",false) 
    guiSetFont(infolbl,"default-bold-small") 
    for index, skin in ipairs(skins) do 
            local row = guiGridListAddRow (skinsgrid) 
            guiGridListSetItemText ( skinsgrid, row, _skins, tostring(skin), false, false ) 
    end 
    showCursor(true) 
    end  
      
    addEventHandler("onClientGUIClick", root, 
    function () 
            if (source == takebtn) 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)                             
                        end 
                else 
                    outputChatBox("Please,select a skin of the list.",255,0,0) 
                end 
                elseif (source == closebtn) then 
                 triggerEvent("closeWindow", localPlayer ) 
            end 
    end 
    ) 
      
    function SAPDjob( hitElement ) 
            if ( hitElement == localPlayer ) then 
                    createskinGui ( hitElement ) 
                    if ( windowjob ~= nil ) then 
                        guiSetVisible ( windowjob, true ) 
                        showCursor ( true ) 
                        guiSetInputEnabled ( true ) 
                    end 
            end 
    end 
            addEventHandler("onClientMarkerHit", marker, SAPDjob) 
              
            function FBIjobleave(leaveElement) 
                 if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
                      if guiGetVisible(windowjob) then 
                           guiSetVisible(windowjob, false) 
                           showCursor(false) 
                            
                      end 
                 end 
            end 
            addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) 
              
            function joinTeam() 
                 triggerServerEvent("setSAPD",localPlayer) 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientGUIClick", takebtn , joinTeam, false) 
              
            function removeSAPDWindow() 
                 guiSetVisible(windowjob, false) 
                 showCursor(false) 
            end 
            addEventHandler("onClientGUIClick", Closebtn , removeSAPDWindow, false) 
        
    

  5. Error:32:Access denied @ add account

    function PlayerLogin(username,password,checksave) 
        if not (username == "") then 
            if not (password == "") then 
                local account = getAccount ( username, password ) 
                if ( account ~= false ) then 
                    logIn(source, account, password) 
      
                    triggerClientEvent (source,"hideLoginWindow",getRootElement()) 
                     
                        if checksave == true then 
                            triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password) 
                        else 
                            triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password) 
                        end 
    end 
    end 
    end 
    end 
    addEvent("onRequestLogin",true) 
    addEventHandler("onRequestLogin",getRootElement(),PlayerLogin) 
      
      
      
    function registerPlayer(username,password,passwordConfirm) 
        if not (username == "") then 
            if not (password == "") then 
                if not (passwordConfirm == "") then 
                    if password == passwordConfirm then 
                        local account = getAccount (username,password) 
                        local accountAdded = addAccount(username, password) 
            if (account == false) then 
                        local accountAdded = addAccount(tostring(username),tostring(password)) 
                        if (accountAdded) then 
                                outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [username: #FFFFFF" ..  
    end 
                             
        end 
            end 
                end 
                    end 
                end 
             end 
    end 
    addEvent("onRequestRegister",true) 
    addEventHandler("onRequestRegister",getRootElement(),registerPlayer) 
      
    

  6. 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 ) 
      
    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 
         if not isElementVisibleTo(ambulancee, hitElement) 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) 
      
    function leaveMedic() 
            if isElementVisibleTo(ambulancee, source) then 
               setElementVisibleTo(ambulancee, source, false) 
            end 
    end 
    addEventHandler("setMedic",root,leaveMedic) 
    

×
×
  • Create New...