sckatchof Posted April 6, 2012 Posted April 6, 2012 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)
DNL291 Posted April 6, 2012 Posted April 6, 2012 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) Please do not PM me with scripting related question nor support, use the forums instead.
TAPL Posted April 6, 2012 Posted April 6, 2012 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
sckatchof Posted April 6, 2012 Author Posted April 6, 2012 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
drk Posted April 6, 2012 Posted April 6, 2012 function Pincar() local rowindex, columnindex = guiGridListGetSelectedItem ( GridlOwnerCar ) local carname = guiGridListGetItemText ( GridlOwnerCar, rowindex, columnindex) triggerServerEvent("PinCar", root, localPlayer, carname) end EPT Team Server Development: 0% Learning C++ | C++ is amazing
DNL291 Posted April 6, 2012 Posted April 6, 2012 would be better if you show us the other part of the script and debugscript and root is the same as getRootElement() Please do not PM me with scripting related question nor support, use the forums instead.
sckatchof Posted April 6, 2012 Author Posted April 6, 2012 would be better if you show us the other part of the script and debugscriptand 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" .
DNL291 Posted April 6, 2012 Posted April 6, 2012 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 ) Please do not PM me with scripting related question nor support, use the forums instead.
X-SHADOW Posted April 6, 2012 Posted April 6, 2012 you have to enter an vehicle and test it Because he using local vehicule = getPedOccupiedVehicle(thePlayer) he get the car you sit on . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
drk Posted April 6, 2012 Posted April 6, 2012 (edited) 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 April 6, 2012 by Guest EPT Team Server Development: 0% Learning C++ | C++ is amazing
sckatchof Posted April 6, 2012 Author Posted April 6, 2012 @DNL291 : thanks for help , still don't work and what you change ?
Jaysds1 Posted April 6, 2012 Posted April 6, 2012 ok, I can see everyone posting stuff, when is this triggered? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
drk Posted April 6, 2012 Posted April 6, 2012 sckatchof, try mine. EPT Team Server Development: 0% Learning C++ | C++ is amazing
sckatchof Posted April 6, 2012 Author Posted April 6, 2012 sckatchof, try mine. thanks for help but don't work 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.
TAPL Posted April 6, 2012 Posted April 6, 2012 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
drk Posted April 6, 2012 Posted April 6, 2012 In the gridlist, appears vehicle name, id or other thing? TAPL, I only changed his code. EPT Team Server Development: 0% Learning C++ | C++ is amazing
sckatchof Posted April 6, 2012 Author Posted April 6, 2012 you want attached a blip to vehicle name that are saved into grid list? epic fail Yes that what i want
DNL291 Posted April 6, 2012 Posted April 6, 2012 still do not understand What you really want to do Please do not PM me with scripting related question nor support, use the forums instead.
sckatchof Posted April 6, 2012 Author Posted April 6, 2012 still do not understand What you really want to do I want attached a blip to vehicle name that are saved into grid list
TAPL Posted April 6, 2012 Posted April 6, 2012 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
drk Posted April 6, 2012 Posted April 6, 2012 You simply can't. You can't get vehicle element from name. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Jaysds1 Posted April 6, 2012 Posted April 6, 2012 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 My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
DNL291 Posted April 6, 2012 Posted April 6, 2012 @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. Please do not PM me with scripting related question nor support, use the forums instead.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now