Jump to content

Cars


eAd

Recommended Posts

  • Discord Moderators

Like said before this aren't proper errors. They don't tell us anything about what is wrong so be more specific please. ;) In case the script doesn't throw any errors then please tell us exactly where it goes wrong. We cannot help if you don't tell us anything we need to know.

Link to comment

Instead of not helping him and insulting him you can test it on your local server(everyone with "omg show debugscript 3"). eAd, I'd suggest you start over with learning Lua, instead of screaming "plzz help repier my full code".

Okay, the first error is that you can't use numbers as variables, so change the button variables to a name.

Second, you had a error on line 67 using "]" (must be a typo)

3th, line 85 to 91 doesn't make any sense.

You must put on the x,y,z a position also, i don't like variables which are called "marker" because it's suggested as a element type, and I changed the button showing (which variable didn't excist) to the window. Plus you should move the button click inside one function.

So here's the client side:

GUIEditor = { 
    gridlist = {}, 
    memo = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        wnd = guiCreateWindow(191, 82, 474, 427, "[PS] Cars System By Mostafa", false) 
        guiWindowSetSizable(wnd, false) 
        guiSetAlpha(wnd, 0.92) 
        guiSetProperty(wnd, "CaptionColour", "FF788D6B") 
  
        but1 = guiCreateButton(9, 19, 129, 79, "NGR-500", false, wnd) 
        guiSetFont(but1, "default-small") 
        guiSetProperty(but1, "NormalTextColour", "FF1A0AF4") 
        but2 = guiCreateButton(9, 130, 129, 73, "Banshee", false, wnd) 
        guiSetFont(but2, "default-small") 
        guiSetProperty(but2, "NormalTextColour", "FF24F508") 
        but3 = guiCreateButton(9, 258, 129, 70, "BMX", false, wnd) 
        guiSetFont(but3, "default-small") 
        guiSetProperty(but3, "NormalTextColour", "FFF92603") 
        but5 = guiCreateButton(155, 20, 116, 78, "Alpha", false, wnd) 
        guiSetFont(but5, "default-small") 
        guiSetProperty(but5, "NormalTextColour", "FFC536C3") 
        but6 = guiCreateButton(154, 139, 136, 64, "GTR-500", false, wnd) 
        guiSetFont(but6, "default-small") 
        guiSetProperty(but6, "NormalTextColour", "FF1909F1") 
        but7 = guiCreateButton(164, 266, 136, 62, "Bobcat", false, wnd) 
        guiSetFont(but7, "default-small") 
        guiSetProperty(but7, "NormalTextColour", "FF05DBF4") 
        GUIEditor.memo[1] = guiCreateMemo(12, 334, 298, 83, "New Cars In GridList \n\n,Mostafa [PS]\n\nUpdate : Add Yamaha R1", false, wnd) 
        GUIEditor.gridlist[1] = guiCreateGridList(319, 24, 145, 393, false, wnd) 
        guiGridListAddColumn(GUIEditor.gridlist[1], "New Cars", 0.9) 
        for i = 1, 4 do 
            guiGridListAddRow(GUIEditor.gridlist[1]) 
        end 
        guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "BMW|SOON", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "Ferari|SOON", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], 2, 1, "PS Car| SOON", false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], 3, 1, "Yamaha R1 ", false, false)     
    end 
) 
  
addEventHandler ( 'onClientGUIClick', resourceRoot, function( ) 
    if ( source == but1) then 
        triggerServerEvent ( 'car1', localPlayer ) 
    elseif ( source == but2) then 
        triggerServerEvent ( 'car2', localPlayer ) 
    elseif ( source == but3) then 
        triggerServerEvent ( 'car3', localPlayer ) 
    elseif ( source == but4) then 
        triggerServerEvent ( 'car4', localPlayer ) 
    elseif ( source == but5) then 
        triggerServerEvent ( 'car5', localPlayer ) 
    elseif ( source == but6) then 
        triggerServerEvent ( 'car6', localPlayer ) 
    elseif ( source == but7) then 
        triggerServerEvent ( 'car7', localPlayer ) 
        end 
    end 
) 
  
local markerD = createMarker(0,0,0,"cylinder", 4 ) 
addEventHandler('onClientMarkerHit',markerD,function (plr) 
    if plr == localPlayer then 
        guiSetVisible(wnd,true) 
        showCursor ( true ) 
        end 
    end 
) 

On the server side you had wrong event handlers attachment. So here's the fix:

vehicle = {} 
  
  
addEvent( 'car1', true ) 
addEventHandler( 'car1', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 431, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 
  
  
addEvent( 'car2', true ) 
addEventHandler( 'car2', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 432, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 
  
  
addEvent( 'car3', true ) 
addEventHandler( 'car3', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 434, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 
  
  
addEvent( 'car4', true ) 
addEventHandler( 'car4', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 421, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 
  
  
addEvent( 'car5', true ) 
addEventHandler( 'car5', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 132, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 
  
  
addEvent( 'car6', true ) 
addEventHandler( 'car6', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 232, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 
  
  
addEvent( 'car7', true ) 
addEventHandler( 'car7', root,function() 
    local x, y, z = getElementPosition ( source ) 
        if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end 
            vehicle[source] = createVehicle ( 442, x, y, z + 10 ) 
                outputChatBox ( "Car Spwan!", source) 
    end 
) 

And for you guys here, if someone can't speak proper english then don't judge him that he doesn't have a brain...

Edited by Guest
Link to comment
  • Discord Moderators

This can be done by changing the parameters given to "createMarker". I'll highlight them for you:

createMarker(0,0,0,"cylinder", 4, 255, 255, 255 )

Red: This determines what size the marker needs to have.

Green: This determines the color in this specific order: red, green, blue. All of these values can range from 0 to 255. 0 basically means this color won't be used at all while 255 is the exact opposite.

For more information I suggest checking out this wiki page.

Link to comment
Anyone trying to get help should do some work by themselfs. That's basically why I refused to test it out by myself.

Yeah, sure. He tried to code it right? If this guy didn't know what "debugscript" was then he's pretty new to scripting in MTA. So he asked the forums for help, and then gets stupid reactions like "meep meep, show your full debugscript 3".

Gosh, these forums where 4 years ago pretty different, the people were so much friendlier to each other. I don't want to discuss here, I only want to make it clear, if you want to discuss with me then you can send me a PM.

Kindly regards,

Danny.

Link to comment
Anyone trying to get help should do some work by themselfs. That's basically why I refused to test it out by myself.

Yeah, sure. He tried to code it right? If this guy didn't know what "debugscript" was then he's pretty new to scripting in MTA. So he asked the forums for help, and then gets stupid reactions like "meep meep, show your full debugscript 3".

Gosh, these forums where 4 years ago pretty different, the people were so much friendlier to each other. I don't want to discuss here, I only want to make it clear, if you want to discuss with me then you can send me a PM.

Kindly regards,

Danny.

They were friendly, but because no one was asking to that stupid questions and they were using google or wiki on their own.

Link to comment
Thanx

Create this createMarker(0,0,0,"cylinder", 4, 255, 255, 255 )

In my code ?

If you'd like to have a red marker you must have it like this

createMarker(0,0,0,"cylinder", 4, 255, 0, 0 ) 

It's RGB

R = Red | Maximal value is 255 (Clearly red)

G = Green

B = Blue

Also if you want to get more colors you can use this free colorpicker

http://colorpicker.net/

Link to comment
  • Discord Moderators
Anyone trying to get help should do some work by themselfs. That's basically why I refused to test it out by myself.

Yeah, sure. He tried to code it right? If this guy didn't know what "debugscript" was then he's pretty new to scripting in MTA. So he asked the forums for help, and then gets stupid reactions like "meep meep, show your full debugscript 3".

Gosh, these forums where 4 years ago pretty different, the people were so much friendlier to each other. I don't want to discuss here, I only want to make it clear, if you want to discuss with me then you can send me a PM.

Kindly regards,

Danny.

I know what you mean and I always was polite towards him. That's just how it should be. But in case you're trying to get help you'll have to give some extra information like errors by yourselfs since that's not exactly what we should do by ourselfs.

Thanx

Create this createMarker(0,0,0,"cylinder", 4, 255, 255, 255 )

In my code ?

That adds the extra parameters for the colors yes. You'll have to override your previous "createMarker" if you want to change it. Currently the marker will be white and stil use the same size. So if you for example change the 4 into a 3 (meters) you'll notice that the marker has become smaller.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...