-
Posts
85 -
Joined
-
Last visited
Posts posted by Strike27208
-
-
Thanks man , it's working , cheers
-
Ok , thanks.
-
3 minutes ago, LoPollo said:
mmm... try localPlayer:getOccupiedVehicleSeat() instead of localPlayer.vehicleSeat
Same Error.
localPlayer:getOccupiedVehicleSeat(vehicle , 0 )
-
2 minutes ago, LoPollo said:
You make the function end if there's any player at seat 1-2-3, but i guess that's not what you want
You are checking if the drivers exists. That's also not what you are looking for. You want to know if the driver is the localPlayer
if localPlayer.vehicleSeat == 0 then
attempt to index a global "localPlayer" a userdata value , hmmmm ?
-
21 minutes ago, LoPollo said:
to check if localPlayer is the driver use getPedOccupiedVehicleSeat. If it does return 0, then localPlayer is the driver
I used this and didn't work :
local driver = getVehicleOccupant(veh, 0) local p1 = getVehicleOccupant(veh, 1) local p2 = getVehicleOccupant(veh, 2) local p3 = getVehicleOccupant(veh, 3) if fuel <=5 then if p1 or p2 or p3 then return false end if driver then sound = playSound("sound/beep.mp3" , true) setSoundVolume(sound, 0.1) setSoundSpeed ( sound, 0.9 ) outputChatBox ( "#FF0000Alarm ! #FFFFFFLow fuel ! Press ' Z ' to stop the alarm.", 255, 255, 255, true ) bindKey ( "Z", "down", stopMySoundB ) addEventHandler ( "onClientVehicleExit", root, stopMySoundV ) killTimer(aMyTimer) end end end
-
Hey , how i can to play sound for driver only ? this is my code , i tried to make but i failed and i need some help :
function helicopter () if ( isPedInVehicle ( localPlayer ) == false ) then return false end local vehicle = getPedOccupiedVehicle(getLocalPlayer()) if vehicle then if ( policeVehicles[getElementModel ( vehicle )] ) then local maxfuel = tonumber(getElementData(vehicle, "maxfuel")) or 0; local fuels = math.floor(tonumber(getElementData(getElementData(vehicle, "parent"), "fuel"))) or 0; if fuels <=5 then sound = playSound("sound/beep.mp3" , true) setSoundVolume(sound, 0.1) setSoundSpeed ( sound, 0.9 ) outputChatBox ( "#FF0000Alarm ! #FFFFFFLow fuel ! Press ' Z ' to stop the alarm.", 255, 255, 255, true ) bindKey ( "Z", "down", stopMySoundB ) addEventHandler ( "onClientVehicleExit", root, stopMySoundV ) killTimer(aMyTimer) end end end end aMyTimer = setTimer( helicopter, 5000,0)
-
Hey , i come back here because i find a new bug :)) , if i'm with other player in vehicle the alarm won't start , this is my code :
local driver = getVehicleOccupant(veh, 0) local p1 = getVehicleOccupant(veh, 1) local p2 = getVehicleOccupant(veh, 2) local p3 = getVehicleOccupant(veh, 3) if fuel <=5 then if p1 or p2 or p3 then return false end if driver then sound = playSound("sound/beep.mp3" , true) setSoundVolume(sound, 0.1) setSoundSpeed ( sound, 0.9 ) outputChatBox ( "#FF0000Alarm ! #FFFFFFLow fuel ! Press ' Z ' to stop the alarm.", 255, 255, 255, true ) bindKey ( "Z", "down", stopMySoundB ) addEventHandler ( "onClientVehicleExit", root, stopMySoundV ) killTimer(aMyTimer) end end end
-
I use to activate my function
if driver then sound = playSound("sound/beep.mp3" , true) setSoundVolume(sound, 0.2) outputChatBox ( "#FF0000Alarm ! #FFFFFFLow fuel ! Press ' Z ' to stop the alarm.", 255, 255, 255, true ) bindKey ( "Z", "down", stopMySoundB ) addEventHandler ( "onClientVehicleExit", root, stopMySoundV ) killTimer(aMyTimer) end
-
Oh man thank you very much , it's working , thaaaaaaanks !!!!! Last code are working.
-
I have the event attached. This is server part ?
-
Nope , i don't use local , still not working , but thanks for help man , i appreciate. No warrnings or erros in debugscript.
I used this to play sound only for driver seat and it's working , when i tried to use for that function he give that warrning , can you tell me why ?
local driver = getVehicleOccupant(veh, 0) local p1 = getVehicleOccupant(veh, 1) local p2 = getVehicleOccupant(veh, 2) local p3 = getVehicleOccupant(veh, 3) if fuel1 <= 6 then if p1 or p2 or p3 then return false end if driver then sound = playSound("sound/beep.mp3" , true) setSoundVolume(sound, 0.2)
-
Hmm i tried but still not work
function stopMySoundV() local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then local driver = getVehicleController(veh , getLocalPlayer()) if driver then local drivers = getVehicleOccupant(veh, 0) local p1 = getVehicleOccupant(veh, 1) local p2 = getVehicleOccupant(veh, 2) local p3 = getVehicleOccupant(veh, 3) if p1 or p2 or p3 then return false end if drivers then stopSound (sound) unbindKey ( "Z", "down", stopMySoundB ) removeEventHandler( "onClientVehicleExit", root, stopMySoundV ) if not isTimer ( aMyTimer ) then aMyTimer = setTimer( helicopter, 5000,0) end end end end end
Tell me if i am wrong.
-
Thanks man it's work , now i made a sistem like only driver to hear the sound , this work but when i want exit from vehicle the sound are not stopping and i get an warnging in debugscript like this :
My code :
function stopMySoundV() local veh = getPedOccupiedVehicle(getLocalPlayer()) local driver = getVehicleOccupant(veh, 0) local p1 = getVehicleOccupant(veh, 1) local p2 = getVehicleOccupant(veh, 2) local p3 = getVehicleOccupant(veh, 3) if p1 or p2 or p3 then return false end if driver then stopSound (sound) unbindKey ( "Z", "down", stopMySoundB ) removeEventHandler( "onClientVehicleExit", root, stopMySoundV ) if not isTimer ( Check ) then Check = setTimer( helicopter, 5000,0) end end end
-
Hey i make this script when you have low fuel to start a sound alarm but i don't know how to make to check this when you are in helicopter :
function helicopter () if ( isPedInVehicle ( localPlayer ) == false ) then return false end ---------------------------Parts----------------------- local veh = getPedOccupiedVehicle(getLocalPlayer()); local maxfuel = ---myStuff--; local fuel = ---myStuff----------; if (isElement(veh) and getElementModel(veh) == 487 or 497 or 417 or 563 ) then if fuel <= 5 then sound = playSound("sound/beep.mp3" , true) setSoundVolume(sound, 0.2) outputChatBox ( "#FF0000Alarm ! #FFFFFFLow fuel ! Press ' Z ' to stop the alarm.", 255, 255, 255, true ) bindKey ( "Z", "down", stopMySoundV ) addEventHandler ( "onClientVehicleExit", root, stopMySound ) killTimer(tm) end end end tm = setTimer (helicopter , 5000 , 0) addEventHandler ( "onClientResourceStart", root, helicopter ) function stopMySound() stopSound ( sound ) unbindKey ( "Z", "down", stopMySoundV ) end function stopMySoundV() stopSound ( sound ) removeEventHandler( "onClientVehicleExit", root, stopMySound ) end
This all work , but when he kill the timer i can't use ' resetTimer ' because he killed it , so how to make to reset that timer when he leave the vehicle ? this work first time , but when i enter again in vehicle he wont verify again.
-
Use this man
toggleControl ( thePlayer, "aim_weapon", false ) -- disable their fire key toggleControl ( thePlayer, "fire", false ) -- disable their fire key --------------------------------------------------------------------- toggleControl ( thePlayer, "aim_weapon", true ) -- enable their fire key toggleControl ( thePlayer, "fire", true ) -- enable their fire key
-
On 11/7/2016 at 2:42 PM, Dealman said:
Use triggerLatentClientEvent to transfer data(see fileOpen, fileRead, fileWrite, fileClose), since this is a latent event handler - it will not pause other traffic. Use getLatentEventStatus to get the progress, and then use dxDrawText and/or dxDrawRectangle as you please.
You can probably find some already made on the community, but I sincerely doubt you'll learn much if you try and salvage those for code. Start simple, go from there.
Thansk Man !
-
Thanks Dzsozi , i will try.
-
Soo , how to do more exactly ?
-
How i can create a new download bar becasue the original one are not triggered if i use "downloadFile " . I have this code for convert size : i need some help , what i need to use to make a download bar.
function sizeFormat(size) local size = tostring(size) if size:len() >= 4 then if size:len() >= 7 then if size:len() >= 9 then local returning = size:sub(1, size:len()-9) if returning:len() <= 1 then returning = returning.."."..size:sub(2, size:len()-7) end return returning.." GB"; else local returning = size:sub(1, size:len()-6) if returning:len() <= 1 then returning = returning.."."..size:sub(2, size:len()-4) end return returning.." MB"; end else local returning = size:sub(1, size:len()-3) if returning:len() <= 1 then returning = returning.."."..size:sub(2, size:len()-1) end return returning.." KB"; end else return size.." B"; end end
:
-
Thanks MIKI785 , now if i get nil from xml , that mean he dont find that shortcut , i have this :
xmlNodeSetAttribute(settings, "car", "true") -- nil argunment 1 , argument 1 is "settings" .
He don't find xml , i tried to put
local currentFile = xmlLoadFile ("savedsettings.xml")
No more warrnings but he don't change in savedsettings.xml nothing , all are false . ,
-
It's start like this :
function createXML() local exists = fileExists ( "savedsettings.xml" ) if not exists then settings = xmlCreateFile("savedsettings.xml","settings") if guiCheckBoxGetSelected(vehPanel.checkbox[1]) then xmlNodeSetAttribute(settings, "car", "true") else xmlNodeSetAttribute(settings, "car", "false") end end addEventHandler("onClientPlayerJoin", getRootElement(), createXML) ----Gui vehPanel.checkbox[1] = guiCreateCheckBox(0.03, 0.02, 0.05, 0.07, "", false, true, vehPanel.tab[1]) vehPanel.button[1] = guiCreateButton(0.71, 0.80, 0.24, 0.15, "Save", true, vehPanel.tab[1]) ---Here save my checkbox addEventHandler ( "onClientGUIClick", getRootElement(), function() if source == vehPanel.button[1] then xmlSaveFile(settings) xmlUnloadFile(settings) guiSetVisible( vehPanel.window[1], false ) end end ) ----------Function function veh1(file, success) local exists = fileExists ( "vehicles/car.txd" and "vehicles/car.dff" ) if not exists then exports.notification:outputTopBar("[ERROR] You don't have this car .", 255, 0, 0) guiCheckBoxSetSelected(vehPanel.checkbox[1],false) currentTrack = playSound ( "error.wav" ) end if guiCheckBoxGetSelected( vehPanel.checkbox[1] ) == true then xmlNodeSetAttribute(settings, "car", "true") local exists = fileExists ( "vehicles/car.txd" and "vehicles/car.dff" ) if exists then exports.notification:outputTopBar("Car mod enabled", 0, 255, 0) local changeTXD = engineLoadTXD ("vehicles/car.txd") local changeDFF = engineLoadDFF ("vehicles/car.dff") engineImportTXD ( changeTXD, 568 ) engineReplaceModel (changeDFF, 568) guiLabelSetColor ( vehPanel.label[1], 0, 255, 0 ) end else xmlNodeSetAttribute(settings, "car", "false") local exists = fileExists ( "vehicles/bandito.txd" and "vehicles/bandito.dff" ) if exists then exports.notification:outputTopBar("Car mod disabled", 255, 0, 0) engineRestoreModel ( 568 ) guiLabelSetColor ( vehPanel.label[1], 219, 219, 219 ) end end end addEventHandler ( "onClientGUIClick", vehPanel.checkbox[1], veh1, false) ---------End function load() local currentFile = xmlLoadFile ("savedsettings.xml") if xmlNodeGetAttribute(currentFile, "car") == "true" then guiCheckBoxSetSelected(vehPanel.checkbox[1], true) veh1() end end load()
This is it.
-
26 minutes ago, Dealman said:
You might wanna save the file first. Use xmlSaveFile. Also, you're not properly closing an if statement in example 1 and 3.
Thanks i used with this :
function createXML() local exists = fileExists ( "savedsettings.xml" ) if not exists then settings = xmlCreateFile("savedsettings.xml","settings") if guiCheckBoxGetSelected(vehPanel.checkbox[1]) then xmlNodeSetAttribute(settings, "car", "true") else xmlNodeSetAttribute(settings, "car", "false") end end addEventHandler("onClientPlayerJoin", getRootElement(), createXML)
And this work but i find i have a big problem with xml , if you know how to work with xml please help me ,
Line :
if guiCheckBoxGetSelected( vehPanel.checkbox[1] ) == true then xmlNodeSetAttribute(settings, "bandito", "true") --------My Stuff end
Why i get that error ? this part is in another function , i don't know if matter or not .
-
Hey , this is my code , He don't create the XML file and i tried this : ( Only Client )
function createXML() if source == vehPanel.button[1] then settings = xmlCreateFile("savedsettings.xml","settings") if guiCheckBoxGetSelected(vehPanel.checkbox[1]) then xmlNodeSetAttribute(settings, "car", "true") else xmlNodeSetAttribute(settings, "car", "false") end end addEventHandler("onClientGUIClick", getRootElement(), createXML)
And this :
function createXML() settings = xmlCreateFile("savedsettings.xml","settings") if guiCheckBoxGetSelected(vehPanel.checkbox[1]) then xmlNodeSetAttribute(settings, "car", "true") else xmlNodeSetAttribute(settings, "car", "false") end end addEventHandler("onClientResourceStart", getRootElement(), createXML)
And this :
function createXML() local exists = fileExists ( "savedsettings.xml" ) if not exists then settings = xmlCreateFile("savedsettings.xml","settings") if guiCheckBoxGetSelected(vehPanel.checkbox[1]) then xmlNodeSetAttribute(settings, "car", "true") else xmlNodeSetAttribute(settings, "car", "false") end end addEventHandler("onClientResourceStart", getRootElement(), createXML)
And no one create xml , i need some help please , this is the end code :
function load() local currentFile = xmlLoadFile ("savedsettings.xml") if xmlNodeGetAttribute(currentFile, "car") == "true" then guiCheckBoxSetSelected(vehPanel.checkbox[1], true) veh1() end end load()
-
Posteaza partea in care dupa ce te-ai logat script-ul distruge gui/dx si te spawneaza. sau posteaza client-ul .
Sau poti incerca asta , tine mine este parte de server.
function onPlayerSpawn ( theSpawnpoint, theTeam ) playSoundFrontEnd ( source, 16 ) end addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn )
In schimb in loc de 16 (16 este un sunet din gta:sa) poti pune sunetul dorit ex :
playSoundFrontEnd ( source, "music.mp3" )
Daca dupa ce s-a logat playerul nu se spawneaza si trebuie sa-si aleaga vreun skin sau altceva atunci te rog sa faci ce ti-am zis mai sus.
Noile spawn-uri de masini, nu functioneaza
in Scripting
Posted
Poftim vehicle table'ul meu , este la fel ca al tau doar ca tu sigur ai ratat sa faci ceva , eu am mai bagat si alte vehicule pe langa cele de baza , sper ca te-am ajutat .
https://www.mediafire.com/file/mkqtqkbuo1y5lsc/vehicles.lua