Sign in to follow this  
sckatchof

Need Help

Recommended Posts

hi guys i have probelm when i blip my car nothing it show this is server side

function PinCar(thePlayer,carname) 
    local vehicule = getVehicleName(carname) 
    if (vehicule) then 
        local blip = createBlipAttachedTo (vehicule, 19, 4, 255, 0, 0, 255, 0, 99999.0, thePlayer) 
    else 
        outputChatBox("vehicule not found",thePlayer,255,0,0) 
    end 
end 
addEvent("PinCar", true) 
addEventHandler("PinCar", getRootElement(), PinCar) 

Share this post


Link to post
function PinCar(thePlayer,carname) 
    local carname = getPedOccupiedVehicle(source) 
    local vehicule = getVehicleName(carname) 
    if (vehicule) then 
        local blip = createBlipAttachedTo (vehicule, 19, 4, 255, 0, 0, 255, 0, 99999.0, thePlayer) 
    else 
        outputChatBox("vehicule not found",thePlayer,255,0,0) 
    end 
end 
addEvent("PinCar", true) 
addEventHandler("PinCar", getRootElement(), PinCar) 

Share this post


Link to post
function PinCar(thePlayer) 
    local vehicule = getPedOccupiedVehicle(thePlayer) 
    if (vehicule) then 
        local blip = createBlipAttachedTo(vehicule, 19, 4, 255, 0, 0, 255, 0, 99999.0, thePlayer) 
    else 
        outputChatBox("vehicule not found",thePlayer,255,0,0) 
    end 
end 
addEvent("PinCar", true) 
addEventHandler("PinCar", getRootElement(), PinCar) 

if you show the trigger this would be better

Share this post


Link to post

if you show the trigger this would be better

client

function Pincar() 
        local rowindex, columnindex = guiGridListGetSelectedItem ( GridlOwnerCar ) 
        local carname = guiGridListGetItemText ( GridlOwnerCar, rowindex, 1) 
        triggerServerEvent("PinCar", getRootElement(), localPlayer, carname) 
end 

Share this post


Link to post
function Pincar() 
        local rowindex, columnindex = guiGridListGetSelectedItem ( GridlOwnerCar ) 
        local carname = guiGridListGetItemText ( GridlOwnerCar, rowindex, columnindex) 
        triggerServerEvent("PinCar", root, localPlayer, carname) 
end 

Share this post


Link to post

would be better if you show us the other part of the script and debugscript

and root is the same as getRootElement()

Share this post


Link to post
would be better if you show us the other part of the script and debugscript

and root is the same as getRootElement()

i post part of server side and client side my problem when i select my car from gridlist and click button "Blip car" it show in chatbox "vehicule not found" .

Share this post


Link to post

try

addEvent("PinCar", true) 
addEventHandler("PinCar", getRootElement(),  
function (thePlayer) 
    local vehicule = getPedOccupiedVehicle(thePlayer) 
    if (vehicule) then 
        local blip = createBlipAttachedTo(vehicule, 19, 4, 255, 0, 0, 255, 0, 99999.0, thePlayer) 
    else 
        outputChatBox("vehicule not found",thePlayer,255,0,0) 
    end 
end 
) 

Share this post


Link to post

you have to enter an vehicle and test it

Because he using local vehicule = getPedOccupiedVehicle(thePlayer) he get the car you sit on .

Share this post


Link to post
function Pincar() 
        local rowindex, columnindex = guiGridListGetSelectedItem ( GridlOwnerCar ) 
        if ( rowindex and columnindex and rowindex ~= -1 and columnindex ~= -1 ) then 
             local carname = guiGridListGetItemText ( GridlOwnerCar, rowindex, columnindex) 
             createBlipAttachedTo ( getVehicleModelFromName ( carname ), 19, 4, 255, 0, 0, 255, 0, 99999.0, localPlayer) 
        end 
end 

Edited by Guest

Share this post


Link to post
sckatchof, try mine.

thanks for help but don't work :cry: i have vehicle panel and i have grid list with my owner car and when i buy a car it show in grid list and i want when i select car and press button blip it show on the map that is my problem.

Share this post


Link to post
function Pincar() 
        local rowindex, columnindex = guiGridListGetSelectedItem ( GridlOwnerCar ) 
        if ( rowindex and columnindex and rowindex ~= -1 and columnindex ~= -1 ) then 
             local carname = guiGridListGetItemText ( GridlOwnerCar, rowindex, columnindex) 
             createBlipAttachedTo ( getVehicleModelFromName ( carname ), 19, 4, 255, 0, 0, 255, 0, 99999.0, localPlayer) 
        end 
end 

getVehicleModelFromName Returns an integer

and createBlipAttachedTo first Argument Required element

-----------------------------------

hey topic owner are you F*** idiot or what?

you want attached a blip to vehicle name that are saved into grid list? epic fail

Share this post


Link to post

In the gridlist, appears vehicle name, id or other thing?

TAPL, I only changed his code.

Share this post


Link to post

you want attached a blip to vehicle name that are saved into grid list? epic fail

Yes that what i want

Share this post


Link to post

still do not understand What you really want to do

Share this post


Link to post
still do not understand What you really want to do

I want attached a blip to vehicle name that are saved into grid list

Share this post


Link to post

you want attached a blip to vehicle name that are saved into grid list? epic fail

Yes that what i want

still do not understand What you really want to do

I want attached a blip to vehicle name that are saved into grid list

omg-shock-face.jpg

Share this post


Link to post

You simply can't. You can't get vehicle element from name.

Share this post


Link to post

try this:

addEventHandler("onClientGUIClick"GridlOwnerCar,function(button) 
    if(button)then 
        local rowindex, columnindex = guiGridListGetSelectedItem ( GridlOwnerCar ) 
        local carname = guiGridListGetItemText ( GridlOwnerCar, rowindex, columnindex) 
        triggerServerEvent("PCar", localPlayer, carname) 
    end 
end,false) 
  
addEvent("Pincar",true) 
addEventHandler("PinCar",root,function(carname) 
    if(carname=="")then 
        for i,cars in ipairs(getElementsByType("vehicle")) do 
            for c,vehicle in ipairs(getVehicleModelFromName(carname)) do 
                createBlipAttachedTo(vehicle,0,3,0,0,0,0,0,65535,client) 
            end 
        end 
    end 
end 

Share this post


Link to post

@TAPL do not understand why I have never seen this script.

I want attached a blip to vehicle name that are saved into grid list

not understand.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.