Jump to content

Correct code


d43dr4

Recommended Posts

Posted

Hello,

I got a code but it was not like i want

this script code makes every Infernus with a blip

but i want it to make only a blip for the car i am on it

So please correct this:

      
    addEventHandler ( "onResourceStart", resourceRoot, 
        function ( ) 
            for _, theVehicles in ipairs ( getElementsByType("vehicle") ) do 
                if string.find ( getElementModel ( theVehicles ), 411 ) then        
                    createBlipAttachedTo ( theVehicles, 55 ) 
                end 
            end 
        end 
    ) 
      

And if u can do a code to make me a blip on the map , my name on game if u need it #[iMr][E'rrOr]_N

THX

Posted

Perhaps this is what you want. Next time, look at your own code. Yours doesn't make sense.

Server-side

local serial = "" 
  
addEventHandler("onResourceStart", resourceRoot, 
    function() 
        for _,vehicle in ipairs(getElementsByType("vehicle")) do 
            if getVehicleController(vehicle) then 
                if getPlayerSerial(getVehicleController(vehicle)) == "" then 
                    createBlipAttachedTo(vehicle, 55, 2, 255, 255, 255, 255, 0, 190) 
                    break 
                end 
            end 
        end 
         
        for _,player in ipairs(getElementsByType("player")) do 
            if getPlayerSerial(player) == serial then 
                createBlipAttachedTo(player, 0, 2, 255, 150, 10, 255) 
                break 
            end 
        end 
    end 
) 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        if getPlayerSerial(source) == serial then 
            createBlipAttachedTo(source, 0, 2, 255, 150, 10, 255) 
        end 
    end 
) 
  
addEventHandler("onVehicleEnter", root, 
    function(player, seat, jacker) 
        if getPlayerSerial(player) == serial then 
            createBlipAttachedTo(source, 55, 2, 255, 255, 255, 255, 0, 190) 
        end 
    end 
) 
  
addEventHandler("onVehicleExit", root, 
    function(player, seat, jacked) 
        if getPlayerSerial(player) == serial then 
            for _,element in ipairs(getAttachedElements(source)) do 
                if getElementType(element) == "blip" then 
                    destroyElement(element) 
                    break 
                end 
            end 
        end 
    end 
) 

Posted
now how to make my self a blip , when iam without a car ?
addCommandHandler("noob-blip", 
function (NoOob) 
if not nblip then 
local nblip = createBlipAttachedTo(NoOob,0) 
else 
destroyElement(nblip) 
end 
end) 

Posted (edited)
i dont want to type a command

if u can give me a script when it starts i will a blip

the code that i've post before is just an example

try to make one your self and stop asking for this kind of help

btw : i've answered you before about special car blip .. right here : viewtopic.php?f=119&t=51197&p=499280#p499279

Edited by Guest
Posted
i try before

if i can make this why i will ask for

before i post to ask for a code i try to make it myself

im not exploitative

well then the code is up there

change it to your requirements .. and let me see what you've done

Posted
now how to make my self a blip , when iam without a car ?

When you with/without a car, you want same blip?

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