Jump to content

[Help] Terminal Script


Booms

Recommended Posts

local hatarped = createPed ( 71, 69.71004, -1532.15381, 5.13079);

setElementData(hatarped, "katt", "hatar");

local hatarkapu = createObject(2909, 68.10683, -1526.46423, 4.85258);

local kor = {createColSphere( 68.53889, -1526.16394, 4.84955, 12.5 )};

addEvent("sikeres", true);

addEventHandler("sikeres", root,

    function(osszeg, localPlayer)

        if (localPlayer) then

        local pMoney = getPlayerMoney(localPlayer);

            if (pMoney >= osszeg) then

                setPlayerMoney(localPlayer, pMoney-osszeg);

                moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 2.5);
                local asd = 1;
                 mit = setTimer(
                    function()
                 asd = asd + 1;        
                local isInSpot = getElementsWithinColShape(kor[1], "player"); 
                
                    if not (#isInSpot > 0) or (asd > 12) then
                                moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 4.85258);
                                if (mit) then
                                killTimer(mit);
                                end
                    end
                end

                    ,1000,0)
                
                 
            end    

        end

    end

);

The problem is:

It watchs all of the player,who are staying in the colshape. I want to watch the localPlayer,who paid the terminal.

Link to comment
  • 2 weeks later...
On 05/05/2020 at 13:47, Booms said:

local hatarped = createPed ( 71, 69.71004, -1532.15381, 5.13079);

setElementData(hatarped, "katt", "hatar");

local hatarkapu = createObject(2909, 68.10683, -1526.46423, 4.85258);

local kor = {createColSphere( 68.53889, -1526.16394, 4.84955, 12.5 )};

addEvent("sikeres", true);

addEventHandler("sikeres", root,

    function(osszeg, localPlayer)

        if (localPlayer) then

        local pMoney = getPlayerMoney(localPlayer);

            if (pMoney >= osszeg) then

                setPlayerMoney(localPlayer, pMoney-osszeg);

                moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 2.5);
                local asd = 1;
                 mit = setTimer(
                    function()
                 asd = asd + 1;        
                local isInSpot = getElementsWithinColShape(kor[1], "player"); 
                
                    if not (#isInSpot > 0) or (asd > 12) then
                                moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 4.85258);
                                if (mit) then
                                killTimer(mit);
                                end
                    end
                end

                    ,1000,0)
                
                 
            end    

        end

    end

);

The problem is:

It watchs all of the player,who are staying in the colshape. I want to watch the localPlayer,who paid the terminal.

local hatarped = createPed ( 71, 69.71004, -1532.15381, 5.13079);

setElementData(hatarped, "katt", "hatar");

local hatarkapu = createObject(2909, 68.10683, -1526.46423, 4.85258);

local kor = {createColSphere( 68.53889, -1526.16394, 4.84955, 12.5 )};

addEvent("sikeres", true);

addEventHandler("sikeres", root,

    function(osszeg, localPlayer)

        if (localPlayer) then

        local pMoney = getPlayerMoney(localPlayer);

            if (pMoney >= osszeg) then

                setPlayerMoney(localPlayer, pMoney-osszeg);

                moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 2.5);
                local asd = 1;
                 mit = setTimer(
                    function()
                 asd = asd + 1;        
                 local within = isElementWithinColShape ( localPlayer, kor )
                
                 if within or (asd > 12) then
                                moveObject(hatarkapu, 1000, 68.10683, -1526.46423, 4.85258);
                                if (mit) then
                                killTimer(mit);
                                end
                    end
                end

                    ,1000,0)
                
                 
            end    

        end
        end)

 

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...