-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
One more... Find bugs in this library please No, seriously now, please make sure the code works before you post it because I don't want people here complaining about your code, you don't want it either do you? Anyway, I have to thank you for actually using it
-
well i guess i made a mistake when codeing it i didnt realize i was useing setVehicleLightState on the driver but now i do so i can recode it now and fix my noobish mistakes Next time just make sure you check what the source of your event/command is and what the functions you use return. That can save you a lot of hassle and perhaps save from using unnecessary variables. Actually, source is not passed to the command handler function but events. Even though, NEVER use source in the parameters list because function will get confused and you will get unexpected results.
-
Don't make things without your head because one day you'll wake up with an unexpected baby next to you. Also, please post suggestions not the code because I'll probably won't use that code anyway.
-
This code is server-side and should work: function flashl ( player ) local theVehicle = getPedOccupiedVehicle( player ) if ( theVehicle and getVehicleOccupant( theVehicle ) == player ) then -- this will also check if player is the driver local state = getVehicleLightState( theVehicle, 3 ); setVehicleLightState ( theVehicle, 3, (state == 0) and 1 or 0 ) end end function flashr ( player ) local theVehicle = getPedOccupiedVehicle( player ) if ( theVehicle and getVehicleOccupant( theVehicle ) == player ) then -- this will also check if player is the driver local state = getVehicleLightState( theVehicle, 2 ); setVehicleLightState ( theVehicle, 2, (state == 0) and 1 or 0 ) end end function carflashl ( player ) setTimer ( flashl, 1000, 10, player ) end function carflashr ( player ) setTimer ( flashr, 1000, 10, player ) end addCommandHandler("lf", carflashl) addCommandHandler("rf", carflashr)
-
- What is theVehicle in your code (eg. line 2, in getVehicleOccupant call)? - Are you sure theVehicle a vehicle element? - Why do you use getVehicleOccupant (get the driver of theVehicle) and use setVehicleLightState on the driver?
-
I'm glad it worked. I'm sure such thing shouldn't crash your client.
-
Alexander, you can't have variable number of arguments if "..." is used as first parameter. It always MUST be at the end of parameters. I don't know how you could make it and didn't give you any errors. ... - this contains every next parameter passed to the function. So, if you use it as the first parameter the next parameters would never be used and therefore Lua would throw an error. Besides, why do you create a new table of arguments and another one to get the number of arguments if arg (the table with parameters) exists when ... is used? HERE is some Lua reference that might be useful for you.
-
If it's client-side script you will fail because command handler doesn't pass player/ped element to functions. If it's server-side I don't see anything wrong and will test this code when I wake up if you'll still have problem with this.
-
Add false to each: addEventHandler( "onClientGUIClick", ...... , false ); This should prevent from crashing. If it still crashes then try to create GUI in onClientResourceStart and show/hide it whenever you need it. Besides, you don't have to removeEventHandler if you destroyElement because they are removed when elements are destroyed.
-
Post the code that creates the UI elements. Also, do you have any double-click event handlers?
-
How do you mean? I don't get it... He's trying to tell you to use the map files instead of creating markers inside your script. http://development.mtasa.com/index.php? ... ement_tree http://development.mtasa.com/index.php? ... ment_Types
-
Probably server doesn't like you removing command handler in the command. BTW, why do you want to remove the command for everyone when 1 cop types it in? Make a global table of players and check if they can use the command or not. g_Players = { }; -- somewhere at the top of your script ... -- let him use the command g_Players[ player ] = true; ... -- disable the command for him: g_Players[ player ] = false; ... -- inside the function called by command if g_Players[ player ] then -- can he use the command?
-
It's not a variable. It's an iterator function that is used in pairs() function. You can do either, for key, value in next, tab do or for key, value in pairs( tab ) do This should work: -- ... Your code above addEventHandler( "onMarkerHit", getRootElement(), function( ) for k,marker in pairs( foodTable ) do -- go through all food markers if source == marker then -- and find out if hit marker (source) is one of markers in foodTable -- OK, you hit a food marker break; -- break the loop because you found what you wanted... end end end )
-
- http://development.mtasa.com/index.php?title=SetTime - http://development.mtasa.com/index.php? ... teDuration - to call a function at specific time you need to make a timer that calls a function which checks the time. Or whenever you change the time with setTime check what time you're setting and call the function.
-
I've made a very simple ped resource long time ago. It may come in handy and teach you something (it does use controls instead of animations): https://community.multitheftauto.com/index.php?p= ... ils&id=234
-
Can't you make the window larger or whatever you use? Window has specific size, you can make it larger or smaller (guiSetSize). When creating new window you specify how big the window should be (guiCreateWindow).
-
http://development.mtasa.com/index.php? ... nistrators MTA hasn't got defined list of rights but by looking at the existing rights in acl.xml you should understand what rights are possible and what's the pattern follows.
-
I guess he just posted a piece of his code. If he has error: That means the script has ran but failed when calling getClientName. When you forget about ends you get unexpected symbol near ''.
-
That's exactly what I posted in the first post. I wonder why people are so ignorant and can't be arsed to read a few lines of code that is commented to make things clear. Talasma, I do "put link where is related things" but as I said, you're ignorant and CBA to read and understand. If you made a truck mission and it works fine but one thing then congratulations. But that also explains you have scripting knowledge and know how scripts work, so you shouldn't even post here because you know what is the problem with your script. If you're saying you're a noob then I give you a link so that you can learn from it and have more knowledge, also not being a noob any more.
-
Why it doesn't work? What happens when you use timer? "doesn't work" doesn't really help us. Tell us more, like nothing happens when you hit the marker? Marker doesn't show up? Please tell us more so we can find out where the problem is.
-
In what way my previous post was negative? Explain that if you can... I'm one of those people that usually get answers like, "Thank you!", "You helped me a lot!"... As you said, you can't make truck mission because you can't script... How do you want to script if you don't want to learn to script? You just don't understand how scripts work. The link I posted explains in what order script executes. Once you know that you will figure out how to fix what you're making. Just because I based the example on GUI doesn't mean it doesn't apply to your script. It applies to every part of your script.
-
https://forum.multitheftauto.com/viewtop ... er#p289183 Read my post on how scripts work. You should be able to figure out why your script doesn't work.
-
Does it happen to Remington only?
-
He wanted to know the model ID that this texture belongs to. I can't remember this skin being used in game... R* must have forgotten about this texture and left it in gta3.img.
