Jump to content

Help Event Script


WiBox

Recommended Posts

       

local spawnpoints1 =
{
        {-2309.55859375, 2488.8388671875, 188},
        {-2366.84765625, 2276.849609375, 188},
        {-2566.3779296875, 2234.146484375, 188},
        {-2704.232421875, 2390.80078125, 188},
	{-2627.060546875, 2578.6552734375, 188},
	{-2453.2021484375, 2611.2802734375, 188},
	{-2311.50390625, 2474.6533203125, 188},
	{-2368.353515625, 2270.7685546875, 188},
	{-2533.52734375, 2225.6337890625, 188},
	{-2669.2685546875, 2309.62890625, 188},
	{-2680.62890625, 2501.0693359375, 188},
	{-2592.1572265625, 2598.8330078125, 188},
	{-2409.0634765625, 2594.9189453125, 188},
	{-2323.4765625, 2475.3525390625, 188},
	{-2367.91015625, 2287.9306640625, 188},
}
warp_warpedUsers = {}
warp_savePos = {}
warp_warpLimit = 0
warp_warps = 15
warp_event = false
wapx, wapy, wapz = unpack(spawnpoints1[math.random(1,#spawnpoints1)])
warp_dimension = 0
warp_interior = 0

    function warpPerson(player)
        local team = getPlayerTeam(player)
        if (not team) then
            return
        end
        if (warp_event == false) then
            return
        end
        if ( doesPedHaveJetPack(player)) then
            outputChatBox("You can't join this event if you're using jetpack.",player, 255, 0, 0)
        end
        if (isPedInVehicle(player)) then
            outputChatBox("You can't join this event if you wasn't on foot.",player, 255, 0, 0)
        end
        if (exports.OSCprison:isPlayerJailed(player)) then
            return
                outputChatBox("You're in Jail! You can't join the event.", player, 255, 0, 0, true)
        end
        if (isPlayerInEvent(player)) then
            outputChatBox("You have already used the command, if you want to leave the event use the command /leaveevent .", player, 0, 255, 0, true)
            return
        end
        if (tonumber(warp_warps) < tonumber(warp_warpLimit) and warp_event) then
            if (not getPedOccupiedVehicle(player)) then
                if (not isPlayerInEvent(player)) then
                    local px, py, pz = getElementPosition(player)
                    local pint, pdim = getElementInterior(player), getElementDimension(player)
                    warp_savePos[getAccountName(getPlayerAccount(player))] = {px, py, pz, pint, pdim}
                end
                if (warp_interior == 0) then
                    if (getElementInterior(player) ~= 0 ) then
                        outputChatBox("You should be at the main interior to join the event.",player, 255, 0, 0)
                    end
                    setElementPosition(player, wapx, wapy, wapz)
                else
                    setElementInterior(player, warp_interior, wapx, wapy, wapz)
                end
                setElementDimension(player, warp_dimension)                   
                addPlayerToEvent(player)
                warp_warps = warp_warps + 1
                if (tonumber(warp_warps) >= tonumber(warp_warpLimit)) then
                    outputChatBox("The event is now full", root, 0, 255, 0, true)
                end
            end
        else
            exports.DENdxmsg:createNewDxMessage("The event has reached the limit of " .. (warp_warpLimit) .. " warps", player, 0, 255, 0, true)
        end
    end 
    addCommandHandler("joinevent", warpPerson)

    function addPlayerToEvent(player)
        if (isElement(player)) then
            setElementData(player, "a", true)
            setElementPosition = wapx, wapy, wapz
        end
    end

As you see I'm trying to make a event but I can't understand where I fail, because I'm not getting warped.. Any help please? And thanks.

Link to comment

Mate it is, just the DEN I take it from an old friend ^_^, Is there a way I can like change the warp_event to true, because I'm making a auto event, so I made a way to start event with a function but I didn't know how to add it to another function,,, function name is= startEvent

Thanks for help xD

Link to comment
29 minutes ago, SSKE said:

No problem I fix it, what I mean, I create this script, but the DENdxmsg script is from a old friend who got that script and he gave me it. Anyway Thanks for you're help!

If you actually created this script you would know that changing line 23 will solve your problem. but I highly doubt you know what you're doing here.

Link to comment
1 minute ago, SSKE said:

Mate I wanted to change from false to true in warp_event but I fix it anyway thanks

You made a topic to ask someone to fix "your" script, which would be fixed if you changed false to true? :)

Link to comment

No it just I forget to add ,   createEvent()    , and I was checking the file and I saw I forget to add this ^-^ , and I made this topic thinking if I made something wrong in this coding without realize I forget to add createEvent() on setTimer ^-^ 

Link to comment

A new problem appeared, it worked first but then they tell me: 

bd argument @ 'doesPedHaveJetpack' [ Expected ped at argument 1, got nil]

bad argument @ 'isPedInVehicle' [ Expected ped at argument 1, got nil]

Everything which I used with it (player) as a argument it saying a nil value? Why is that happening? First time it happen to me I don't know how to fix it ..

Edited by SSKE
Link to comment
33 minutes ago, SSKE said:

A new problem appeared, it worked first but then they tell me: 

bad argument @ 'doesPedHaveJetpack' [ Expected ped at argument 1, got nil]

bad argument @ 'isPedInVehicle' [ Expected ped at argument 1, got nil]

Everything which I used with it (player) as a argument it saying a nil value? Why is that happening? First time it happen to me I don't know how to fix it ..

Edit: I used from line 29 to line 75

for _,player in ipairs(getElementsByType("player")) do
    .............
end

 But I didn't understand why that happen with me?       {

                                                                                                  bad argument @ 'doesPedHaveJetpack' [ Expected ped at argument 1, got nil]

                                                                                                  bad argument @ 'isPedInVehicle' [ Expected ped at argument 1, got nil]

                                                                                                                                                                                                                                              }

Not only those two, everything in this function warpPerson using (player) it said {expected ped at argument 1, got nil} can someone tell me why that happen with me? And thanks ~

                

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