Jump to content

Help!! (Mod shop script)


Recommended Posts

Posted

Hey guys, I'm still newbie and I can't write this script correctly, what should I do to make Panel window open when (only) vehicles hit the marker (only that marker)? Waiting for a answer, thanks for reading.

modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ())

Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27)

setBlipVisibleDistance (Blipmodshopls1, 300)

function Panel()

modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false)

guiWindowSetSizable(modshop, false)

Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop)

Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop)

Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop)

Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop)

showCursor ( true )

addEventHandler ( "onClientGUIClick", Exit, Close, false )

addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false )

addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false )

addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false )

end

function MarkerHit( vehicle )

end

addEventHandler ( "onClientMarkerHit", modshopls1, Panel )

function Close()

guiSetVisible (modshop, not guiGetVisible ( modshop ) )

showCursor ( false )

end

function Nitroxx2()

triggerServerEvent ( "onNitroxxx2", getLocalPlayer() )

end

function Nitroxx5()

triggerServerEvent ( "onNitroxxx5", getLocalPlayer() )

end

function Nitroxx10()

triggerServerEvent ( "onNitroxxx10", getLocalPlayer() )

end

Posted
modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ()) 
Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27) 
setBlipVisibleDistance (Blipmodshopls1, 300) 
  
function Panel() 
modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false) 
guiWindowSetSizable(modshop, false) 
Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
  
showCursor ( true ) 
guiSetVisible(modshop, true) 
addEventHandler ( "onClientGUIClick", Exit, Close, false ) 
addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false ) 
addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false ) 
addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false ) 
end 
  
addEventHandler ( "onClientMarkerHit", modshopls1, Panel ) 
  
function Close() 
  
guiSetVisible (modshop, false ) 
showCursor ( false ) 
  
end 
  
function Nitroxx2() 
triggerServerEvent ( "onNitroxxx2", getLocalPlayer() ) 
end 
  
function Nitroxx5() 
triggerServerEvent ( "onNitroxxx5", getLocalPlayer() ) 
end 
  
function Nitroxx10() 
triggerServerEvent ( "onNitroxxx10", getLocalPlayer() ) 
end 

Posted
Hey guys, I'm still newbie and I can't write this script correctly, what should I do to make Panel window open when (only) vehicles hit the marker (only that marker)? Waiting for a answer, thanks for reading.

modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ())

Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27)

setBlipVisibleDistance (Blipmodshopls1, 300)

function Panel()

modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false)

guiWindowSetSizable(modshop, false)

Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop)

Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop)

Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop)

Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop)

showCursor ( true )

addEventHandler ( "onClientGUIClick", Exit, Close, false )

addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false )

addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false )

addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false )

end

function MarkerHit( vehicle )

end

addEventHandler ( "onClientMarkerHit", modshopls1, Panel )

function Close()

guiSetVisible (modshop, not guiGetVisible ( modshop ) )

showCursor ( false )

end

function Nitroxx2()

triggerServerEvent ( "onNitroxxx2", getLocalPlayer() )

end

function Nitroxx5()

triggerServerEvent ( "onNitroxxx5", getLocalPlayer() )

end

function Nitroxx10()

triggerServerEvent ( "onNitroxxx10", getLocalPlayer() )

end

marker = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement()) 
blip = createBlipAttachedTo(marker, 27) 
setBlipVisibleDistance(blip, 300) 
  
function draw() 
    modshop = guiCreateWindow(1230, 285, 323, 433, "Modshop", false) 
    guiWindowSetSizable(modshop, false) 
    Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
    Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
    Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
    Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
    showCursor(true) 
    addEventHandler("onClientGUIClick", Exit, Close, false) 
    addEventHandler("onClientGUIClick", Nitrox2, Nitroxx2, false) 
    addEventHandler("onClientGUIClick", Nitrox5, Nitroxx5, false) 
    addEventHandler("onClientGUIClick", Nitrox10, Nitroxx10, false) 
end 
  
addEventHandler("onClientMarkerHit", modshopls1, function() 
    if isPedInVehicle(getLocalPlayer()) == true then --Check if he is in a vehicle 
        draw() --We call the function to draw the GUI 
    end 
end) 
  
function Close() 
    guiSetVisible(window, false) --There is no need to use a NOT Gate, all you want is to close it (false) 
    showCursor(false) 
end 
  
function Nitroxx2() 
    triggerServerEvent("onNitroxxx2", getLocalPlayer()) 
end 
  
function Nitroxx5() 
    triggerServerEvent("onNitroxxx5", getLocalPlayer()) 
end 
  
function Nitroxx10() 
    triggerServerEvent("onNitroxxx10", getLocalPlayer()) 
end 

Posted
modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ()) 
Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27) 
setBlipVisibleDistance (Blipmodshopls1, 300) 
  
function Panel() 
modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false) 
guiWindowSetSizable(modshop, false) 
Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
  
showCursor ( true ) 
guiSetVisible(modshop, true) 
addEventHandler ( "onClientGUIClick", Exit, Close, false ) 
addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false ) 
addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false ) 
addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false ) 
end 
  
addEventHandler ( "onClientMarkerHit", modshopls1, Panel ) 
  
function Close() 
  
guiSetVisible (modshop, false ) 
showCursor ( false ) 
  
end 
  
function Nitroxx2() 
triggerServerEvent ( "onNitroxxx2", getLocalPlayer() ) 
end 
  
function Nitroxx5() 
triggerServerEvent ( "onNitroxxx5", getLocalPlayer() ) 
end 
  
function Nitroxx10() 
triggerServerEvent ( "onNitroxxx10", getLocalPlayer() ) 
end 

He wanted to open it ONLY if he is in a vehicle

Posted
modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ()) 
Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27) 
setBlipVisibleDistance (Blipmodshopls1, 300) 
  
function Panel() 
modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false) 
guiWindowSetSizable(modshop, false) 
Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
showCursor ( true ) 
addEventHandler ( "onClientGUIClick", Exit, Close, false ) 
addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false ) 
addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false ) 
addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false ) 
end 
addEventHandler ( "onClientMarkerHit", modshopls1, Panel ) 
  
if isPedInVehicle(getLocalPlayer()) == true then 
   Panel() 
end 
  
function Close() 
guiSetVisible (modshop, false ) 
showCursor ( false ) 
end 
  
function Nitroxx2() 
triggerServerEvent ( "onNitroxxx2", getLocalPlayer() ) 
end 
  
function Nitroxx5() 
triggerServerEvent ( "onNitroxxx5", getLocalPlayer() ) 
end 
  
function Nitroxx10() 
triggerServerEvent ( "onNitroxxx10", getLocalPlayer() ) 
end 

Posted
modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ()) 
addEventHandler ( "onClientMarkerHit", modshopls1,  
    function ( hitElement, matchingDimension ) 
        if ( getElementType ( hitElement ) == "player" and matchingDimension ) then 
            if ( isPedInVehicle ( hitElement ) ) then 
                Panel ( ) 
            end 
        end 
    end 
) 
Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27) 
setBlipVisibleDistance (Blipmodshopls1, 300) 
  
function Panel() 
    showCursor ( true ) 
    modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false) 
    guiWindowSetSizable(modshop, false) 
    Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
    Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
    Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
    Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
    addEventHandler ( "onClientGUIClick", Exit, Close, false ) 
    addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false ) 
    addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false ) 
    addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false ) 
end 
  
function Close() 
    if ( isElement ( modshop ) ) then 
        destroyElement ( odshop ) 
    end 
    showCursor ( false ) 
end 
  
function Nitroxx2() 
    triggerServerEvent ( "onNitroxxx2", getLocalPlayer() ) 
end 
  
function Nitroxx5() 
    triggerServerEvent ( "onNitroxxx5", getLocalPlayer() ) 
end 
  
function Nitroxx10() 
    triggerServerEvent ( "onNitroxxx10", getLocalPlayer() ) 
end 

Posted

I tried all, only Dimos7's worked right, I will wait for a friend to try it too, because yesterday I was the only one capable of mod my cars... Will post the results later, thanks all!! Appreciate ur time!

Posted
modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ()) 
Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27) 
setBlipVisibleDistance (Blipmodshopls1, 300) 
  
function Panel() 
modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false) 
guiWindowSetSizable(modshop, false) 
Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
showCursor ( true ) 
addEventHandler ( "onClientGUIClick", Exit, Close, false ) 
addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false ) 
addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false ) 
addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false ) 
end 
addEventHandler ( "onClientMarkerHit", modshopls1, Panel ) 
  
if isPedInVehicle(getLocalPlayer()) == true then 
   Panel() 
else  
   Close() 
   outputChatBox("You aren't in a vehicle", 255, 0, 0) 
end 
  
function Close() 
guiSetVisible (modshop, false ) 
showCursor ( false ) 
end 
  
function Nitroxx2() 
triggerServerEvent ( "onNitroxxx2", getLocalPlayer() ) 
end 
  
function Nitroxx5() 
triggerServerEvent ( "onNitroxxx5", getLocalPlayer() ) 
end 
  
function Nitroxx10() 
triggerServerEvent ( "onNitroxxx10", getLocalPlayer() ) 
end 

Posted

ok guys, I changed few stuff in your scripts and I got it, it works for me, only vehicles and no errors, will wait for other person to try it out and then I'll post. Anyway, here is the final result:

modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ())

addEventHandler ( "onClientMarkerHit", modshopls1,

function ( hitElement, matchingDimension )

if ( getElementType ( hitElement ) == "player" and matchingDimension ) then

if ( isPedInVehicle ( hitElement ) ) then

Panel ( )

end

end

end

)

Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27)

setBlipVisibleDistance (Blipmodshopls1, 300)

function Panel()

showCursor ( true )

modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false)

guiWindowSetSizable(modshop, false)

Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop)

Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop)

Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop)

Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop)

addEventHandler ( "onClientGUIClick", Exit, Close, false )

addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false )

addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false )

addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false )

end

function Close()

guiSetVisible (modshop, false )

showCursor ( false )

end

function Nitroxx2()

triggerServerEvent ( "onNitroxxx2", getLocalPlayer() )

end

function Nitroxx5()

triggerServerEvent ( "onNitroxxx5", getLocalPlayer() )

end

function Nitroxx10()

triggerServerEvent ( "onNitroxxx10", getLocalPlayer() )

end

Posted

I didn't mate, you made a mistake here (this is in your post):

  
function Close() 
    if ( isElement ( modshop ) ) then 
        destroyElement ( odshop ) 
    end 
    showCursor ( false ) 
end 
  

Posted

I used all your lines, all but that, because it was not right. It's good like this:

  
modshopls1 = createMarker(1041.5,-1021.5,31,"cylinder",3.5,250,0,0,100,getRootElement ()) 
addEventHandler ( "onClientMarkerHit", modshopls1, 
    function ( hitElement, matchingDimension ) 
        if ( getElementType ( hitElement ) == "player" and matchingDimension ) then 
            if ( isPedInVehicle ( hitElement ) ) then 
                Panel ( ) 
            end 
        end 
    end 
) 
Blipmodshopls1 = createBlipAttachedTo(modshopls1, 27) 
setBlipVisibleDistance (Blipmodshopls1, 300) 
  
function Panel() 
    showCursor ( true ) 
    modshop = guiCreateWindow(1230, 285, 323, 433, "modshop", false) 
    guiWindowSetSizable(modshop, false) 
    Nitrox2 = guiCreateButton(20, 38, 134, 43, "Nitrox2", false, modshop) 
    Nitrox5 = guiCreateButton(20, 100, 134, 43, "Nitrox5", false, modshop) 
    Nitrox10 = guiCreateButton(20, 163, 134, 43, "Nitrox10", false, modshop) 
    Exit = guiCreateButton(66, 375, 193, 48, "Exit", false, modshop) 
    addEventHandler ( "onClientGUIClick", Exit, Close, false ) 
    addEventHandler ( "onClientGUIClick", Nitrox2, Nitroxx2, false ) 
    addEventHandler ( "onClientGUIClick", Nitrox5, Nitroxx5, false ) 
    addEventHandler ( "onClientGUIClick", Nitrox10, Nitroxx10, false ) 
end 
  
function Close() 
guiSetVisible (modshop, false ) 
showCursor ( false ) 
end 
  
function Nitroxx2() 
    triggerServerEvent ( "onNitroxxx2", getLocalPlayer() ) 
end 
  
function Nitroxx5() 
    triggerServerEvent ( "onNitroxxx5", getLocalPlayer() ) 
end 
  
function Nitroxx10() 
    triggerServerEvent ( "onNitroxxx10", getLocalPlayer() ) 
end 
  

Posted

OK guys, the results with a friend are:

When he goes to the marker, the window appears on me too and his game blocks. He can't move till I turn off the resource. I also want to say that, that file I post there, the .lua file, is client type. I made a server type also, but just with some nitro things... I can't really find the problem...

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