Jump to content

[REL]Info Pickups


Axel

Recommended Posts

I'v noticed that there is no ressource that brings info in-game except the one on the F1 so i decided to make a infopickups ressource. The code is very simple thought i added some help for new scripters.

What it does?

Well it's easy: When u hit a pickup you get a message. The pickup respawns after 1 minute.

As u might see it also clears the chat for other messages.

Image:

6275.png

Download:

https://community.multitheftauto.com/index.php?p=resources&s=details&id=3849

Code:

--[[ 
Info Pickups - Made by Axel aka Serbanescu Gabriel 
Contact: Skype: freestyleaxel 
If your kind, don't delete this Copyright 
]] 
  
infopickups = { 
-- {x, y, z, interior, dimension, "text", color1, color2, color3}, 
{1542.37720, -1682.36157, 13.55438, 0, 0, "TEST PICKUP 1 DUDE!", 0, 255, 255}, 
{1548, -1681, 13, 0, 0, "TEST PICKUP2 DUDE!. ", 0, 255, 255}, 
} 
  
addEventHandler("onResourceStart",getRootElement(), 
function () -- when the ressource start 
    for index, value in pairs(infopickups) do -- loop throught that table 
        local x, y, z, interior, dimension, text, color1, color2, color3 = value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8], value[9] -- take the data we need 
        local pickup = createPickup(x, y, z, 3, 1239, 0) -- create the pickup 
        createBlipAttachedTo(pickup,2,1, 255, 255, 0, 255, 0, 1) -- attach some blip to see where it is 
        setElementInterior(pickup, interior) 
        setElementDimension(pickup, dimension) 
        setElementData(pickup, "text", text) -- set the text 
        setElementData(pickup,"color1",color1) -- set the color 1 
        setElementData(pickup,"color2",color2) -- set the color 2 
        setElementData(pickup,"color3",color3) -- set the color 3 
        setElementData(pickup, "isItInfoPickup", 1) -- Set's if it is really a pickup.. we don't want other pickups to show messages right? 
    end 
    outputDebugString ( "Info Pickups - Made By Axel." ) -- You won't delete it, right? 
end 
) 
  
function matchDimensionInterior(object1, object2) -- This function checks if 2 objects are in the same interior and dimension 
    if (object1) and (object2) then 
        local interior1 = getElementInterior(object1) 
        local interior2 = getElementInterior(object2) 
        local dimension1 = getElementDimension(object1) 
        local dimension2 = getElementDimension(object2) 
        if (interior1 == interior2) and (dimension1 == dimension2) then 
            return true 
        end 
    end 
end 
  
function outputSpace(thePlayer) -- This function outputs some space in the Chat Box 
    outputChatBox(" ",thePlayer) 
    outputChatBox(" ",thePlayer) 
    outputChatBox(" ",thePlayer) 
    outputChatBox(" ",thePlayer) 
end 
  
addEventHandler("onPickupHit",getRootElement(), 
function (thePlayer) 
    if (matchDimensionInterior(thePlayer, source)) then -- if the pickup and the player are in the same dimension, so you can make in different dimensions 
        if (getElementData(source,"isItInfoPickup")  == 1) then -- if the pickup it's really a pickup 
            local text = getElementData(source,"text") 
            local color1 = getElementData(source,"color1") 
            local color2 = getElementData(source,"color2") 
            local color3 = getElementData(source,"color3") 
            outputSpace(thePlayer) 
            outputChatBox("````````````````````````````````````Info````````````````````````````````````",thePlayer,color1,color2,color3) 
            outputChatBox(text,thePlayer,color1,color2,color3) 
            outputChatBox("`````````````````````````````````````````````````````````````````````````````",thePlayer,color1,color2,color3) 
            outputSpace(thePlayer) 
        end 
        cancelEvent() 
    end 
end 
) 

Also, you can check my parking system: http://adf.ly/f6cwQ

Edited by Guest
Link to comment
  • 1 year later...

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