Jump to content

Jail script


nikitafloy

Recommended Posts

Use translate (i feeling problem with translation): Hello I have not received a response to Russian topic , it is necessary to contact you . In this piece of script prisoner sits in jail . The problem is that he is not released. The aim - to record every prisoner in the table with a timer and release on the table. Debag not display errors . But after the change in teams players now do not spawn at the expiration of the timer. Yes, perhaps , is the logic ' curve ' . I 'm trying to write something a little more serious. Otherwise have to put all the prisoners , one in the chamber and release of kolsheypa as well . Will be glad to answer any .

local prisoners = {} -- create a table 
      
    function sitPr (thePlayer, cmd, Psource, toTime) 
        for _, aclGr in ipairs ({'Security', 'FBI'}) do 
            if (isObjectInACLGroup ("user." .. getAccountName (getPlayerAccount (thePlayer)), aclGetGroup (aclGr)) == true) then 
            if (isElementWithinColShape (thePlayer, fP)) then 
                local occup = getPedOccupiedVehicle (thePlayer) 
                if (occup) then 
                if (toTime) then 
                    local toTime = tonumber (toTime) 
                    local Psource = getPlayerFromName (Psource) 
                    if (pC [getElementModel (getPedOccupiedVehicle (thePlayer))]) then 
                            if (toTime < 30 ) then 
                                local rnd = math.random ( 1 , # habz) 
                                    if (getVehicleOccupant (occup, 2 )) then 
                                        local account = getPlayerAccount (Psource) 
                                        local oldskin = setAccountData (account, 'oldskin', tostring (getElementModel (Psource))) 
                                        local oldfgt = setAccountData (account, 'oldfgt', tostring (getPedFightingStyle (Psource))) 
                                        takePlayerMoney (Psource, 15000) 
                                        givePlayerMoney (thePlayer, 15000) 
                                        setTimer (fadeCamera, 2000 , 1 , Psource, true) 
                                        setTimer (function () 
                                            spawnPlayer (Psource, habz [rnd] [ 1 ], habz [rnd] [ 2] , 1004, 90 , 299 , 3, 0 ) 
                                            setCameraTarget (Psource) 
                                        end, 2000 , 1) 
                                        prisoners [# prisoners +1] = {toTime, Psource} -- gets the length of the table and add a new element in the form of { time } player's name . 
                                        setTimer (function () 
                                        for _, i in pairs (prisoners) do -- get a table of the same species . 
                                            Psource = i [ 2] -- ' say' that the name of the player is the data of all tables at No. 2. 
                                            toTimeTo = i [ 1] -- ' say' that the time before the player is the data of all tables at number 1. 
                                                if toTimeTo == toTime then -- if the time is output through time toTime, when the timer expires, designated in advance to land rights. In other words, if the time limit expires , the ... 
                                                elseif toTimeTo then -- Or , if you suddenly turned out that the time of the player < time appointed for advance team landed Psource, then we will produce it . (5 < 30) ( Here is my logic turns off, because this should not be ) 
                                                    local account = getPlayerAccount (Psource) 
                                                    local lodskin = getAccountData (account, 'oldskin') 
                                                    local ofgt = getAccountData (account, 'oldfgt') 
                                                    setPedFightingStyle (Psource, tostring (ofgt)) 
                                                    setCameraTarget (Psource) 
                                                    spawnPlayer (Psource, 2290.19995, 2430.5, 10.8, 180 , tostring (lodskin), 0, 0) 
                                                    prisoners [Psource] = nil -- table.remove () - replacement , but how is it used ? 
                                                elseif toTimeTo> toTime then -- or , if the time before the release of more than the time specified for another prisoner , then we obtain from the first timer 
                                                    if isTimer (toTimeTo) then -- if it exists, 
                                                        toTime = toTimeTo -- set the time for it 
                                                        setTimer (function () 
                                                            local account = getPlayerAccount (Psource) 
                                                            local lodskin = getAccountData (account, 'oldskin') 
                                                            local ofgt = getAccountData (account, 'oldfgt') 
                                                            setPedFightingStyle (Psource, tostring (ofgt)) 
                                                            setCameraTarget (Psource) 
                                                            spawnPlayer (Psource, 2290.19995, 2430.5, 10.8, 180 , tostring (lodskin), 0, 0) 
                                                            prisoners [Psource] = nil -- table.remove () 
                                                        end, toTime * 60000 , 1) -- Now, after a while he gets out 
                                                    else 
                                                        outputChatBox ('No1.') 
                                                    end 
                                                else 
                                                    outputChatBox ('No2.') 
                                                end 
                                        end 
                                        end, toTime * 60000 , 1) 
      
                                        elseif (getVehicleOccupant (occup, 3 )) then 
    ... 
                                        end 
                            end 
                    end 
                end 
                end 
            end 
            end 
        end 
    end 
    addCommandHandler ('sPr', sitPr) 
      
  
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...