Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. It all depends on how you're going to use the data saved. If you want to use MySQL you could make a website where users could log in and sell the cars, buy "new skins", buy weapons, etc. If you're not going to make a website then you can use SQLite or XML. One problem with MySQL/SQLite is that you have to think of a way to save cars.. It's not that simple especially if you haven't got much knowledge about SQL engines. Saving cars in XML files would be easy though. To save all your stuff when player leaves use: onPlayerQuit
  2. 50p

    Missiontimer

    Because you DO NOT read wiki as I told you to If you ever visited the link and found the function getElementsByType you'd know this function returns indexed table of elements not "elements element" (which doesn't exist). You have to loop the players table and set every player's health separately. for i, player in pairs( players ) do setElementHealth( player, 0 ); end READ THE DAMN WIKI. All your questions so far could be answered by looking up the wiki. It's there for a reason. http://development.mtasa.com/index.php
  3. 50p

    Missiontimer

    You can do it anywhere in your scripts. Use: local players = getElementsByType( "player" ); -- get all online players If you know player's name than you can get the player element with: local player = getPlayerFromNick( "Zadara" ); -- get player named Zadara Please use wiki for questions like this. http://development.mtasa.com/index.php?title=Main_Page
  4. Use onClientResourceStart, it must work. Don't use getLocalPlayer() for any event because the function attached to that event won't be called, use getResourceRootElement( getThisResource() ) instead..
  5. 50p

    Transformers

    getElementPosition? Here is the file: http://pastebin.com/f1d144da2 It may not work because there have been lots of changes since the last public test.
  6. 50p

    Transformers

    It doesn't use timers, it used onClientPreRender or onClientRender. I still have the client-side file (somewhere) off public beta-test.
  7. 50p

    Missiontimer

    He means the resources SVN resource called "missiontimer", I think. Thats what i mean. OK, so I can't help because I prefer to make everything by myself and I don't use any other resources but mine (including votemanager, mapmanager, helpmanager, spawnmanager, etc.)
  8. What doesn't work? What should the code do? We need more detail to help you because we don't want to help you in the wrong direction. If you show your code and want it to spawn player and you don't tell us about it but we tell you to use different code which doesn't spawn the player, you gonna complain and keep telling us it doesn't work. We need more details to help you. Besides, use onClientResourceStart if you want to do something to the player that joins the server. Use onClientPlayerJoin if you want to do something joins but you don't want to do anything on that player's side.
  9. What is myWindow doing there as the last parameter in addEventHandler? You don't need it there because addEventHandler doesn't take that many params. Think about what you're trying to do. You want to pop up a window with Password field, right? What do you need to do to make a window with that password field? Create that window and create that text field (password field). What's so difficult about that... you already made one I guess? You need to guiSetVisible of that window (which has the password field) when you click specific "class". When you make the password window, don't forget about a button to accept what user typed in or use onClientGUIAccepted which is triggered when user presses Enter in a text field. Try to think about what you're trying to make and than try to make with the knowledge you already have, if you fail, just ask here, but try first. If you don't try, you'll never learn.
  10. If you don't get any errors in console, check if you don't get any errors/warnings in the debug window (type "/debugscript 3" in chatbox (w/o quotes) or in console (w/o quotes and /)). You should get a warning on that line saying "Bad argument..." How do I know? Well, what is the value returned from your database is string, when you setPlayerTeam you must pass, player and team elements. You should use this instead: setPlayerTeam( source, getTeamFromName( job[1][1] ) )
  11. 50p

    Missiontimer

    How come you have a "missiontimer" but you don't know how it works? If you want it to be "drawn" on screen, you have 2 ways, server-side and client-side. If you want to do it server-side (which IMO is better) you can use Text functions but if you want to do it client-side you can use GUI functions or Drawing functions (both of these have libraries for easier usage: GUI Lib, Textlib). Basically, you need: - a function which will display the text on the screen - a function which will be counting down (that is, it will be called every second), so it will use timer and call function which displays the text or use text functions within this one
  12. About the Auto-Message, do you mean to display these rules in the chatbox? All of them at the same time? You could use my very old script Chatbox ads which displays random message in the chatbox every 10 minutes. Maybe you could use it. Check my profile to see all the resources I made.
  13. You should paste this: showCursor( not isCursorShowing() ) in the F1 bind function, so when you press F1 to show the window, showCursor at the same time (just like console works).
  14. Server-side file: LOCATIONS = { }; -- Add your locations here, -- text between [ and ] MUST be the same as on the buttons -- because client will send text from the buttons: LOCATIONS[ "Location 1" ] = { 886.24, 2479.17, 258.32 }; LOCATIONS[ "Location 2" ] = { 886.24, 2479.17, 258.32 }; addEvent( "YOUR_CUSTOM_EVENT", true ); addEventHandler( "YOUR_CUSTOM_EVENT", getRootElement( ), function( locationName ) if LOCATIONS[ locationName ] then local veh = getPlayerOccupiedVehicle( client ); -- if you don't want to use the 'if' 'else' than you should be able to get the same effect with only one line: -- setElementPosition( ( ( veh and getVehicleOccupant( veh ) == client) and veh or client ), unpack( LOCATION[ locationName ] ) ); -- because you use the same coords for player or vehicle and you use one of them, you can try with the line above... if ( ( veh ) and ( client == getVehicleOccupant( veh ) ) then setElementPosition( veh, unpack( LOCATIONS[ locationName ] ) ); else setElementPosition( client, unpack( LOCATIONS[ locatioName ] ) ); end end end ) Client-side file: addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), function( ) wnd = guiCreateWindow( 509,297,437,286,"Teleport Menu",false ); location1 = guiCreateButton( 10, 20, 100, 19, "Location 1", false, wnd ); addEventHandler( "onClientGUIClick", location1, teleportTo, false ); location2 = guiCreateButton( 10, 40, 100, 19, "Location 2", false, wnd ); addEventHandler( "onClientGUIClick", location1, teleportTo, false ); guiSetVisible( wnd, false ) -- hide the window when resource started and created the window bindKey( "F1", "down", function( ) -- bind the key F1, show/hide window when it's pressed: if wnd then guiSetVisible( wnd, not guiGetVisible( wnd ) ) end end ) end ) function teleportTo( ) -- here you will send text from button to the server, -- so you know which location you want to spawn triggerServerEvent( "YOUR_CUSTOM_EVENT", getLocalPlayer( ), guiGetText( source ) ); end If it still doesn't work, try to fix it yourself. Just try to understand what "warning" and "error" messages tell you and fix it.
  15. Are you sure you weren't talking to robhol? Are You Sure? Why would I say "you don't have to pay" to robhol? And why do you still reply if the problem has been solved? LOL
  16. Oh dear. ...He was trying to help on this one he wasn't running around asking for money (whether sarcasm was involved or not) I was talking to the author of the topic, ROFL
  17. Yes, remember, IT'S FREE! You don't have to pay money for it!
  18. First thing you need to know is that GUI is client-side and you need to set players'/vehicles' position server-side. So, you need to tell the server you want to teleport player to different position. You should start with a few buttons, and than try GridList, because GridList requires more skill than simple button. So try this: (client-side) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), function( ) wnd = guiCreateWindow( 509,297,437,286,"Teleport Menu",false ); location1 = guiCreateButton( 10, 20, 100, 19, "Location 1", false, wnd ); addEventHandler( "onClientGUIClick", location1, teleportTo, false ); location2 = guiCreateButton( 10, 40, 100, 19, "Location 2", false, wnd ); addEventHandler( "onClientGUIClick", location1, teleportTo, false ); end ) function teleportTo( ) -- here you will send text from button to the server, -- so you know which location you want to spawn triggerServerEvent( "YOUR_CUSTOM_EVENT", getLocalPlayer( ), guiGetText( source ) ); end (server-side) LOCATIONS = { }; -- Add your locations here, -- text between [ and ] MUST be the same as on the buttons -- because client will send text from the buttons: LOCATIONS[ "Location 1" ] = { 886.24, 2479.17, 258.32 }; LOCATIONS[ "Location 2" ] = { 886.24, 2479.17, 258.32 }; addEvent( "YOUR_CUSTOM_EVENT", true ); addEventHandler( "YOUR_CUSTOM_EVENT", getRootElement( ), function( locationName ) if LOCATIONS[ locationName ] then local veh = getPlayerOccupiedVehicle( client ); if client == getVehicleOccupant( veh ) then setElementPosition( veh, unpack( LOCATIONS[ locationName ] ) ); end end end ) This was written in the browser, not tested, so it MAY NOT work.
  19. Finally you understood It's you who make people go and never come back because you ask them for money... There are people who can make the scripts for free. You will never understand that because nobody in your entire life "done you a favour for free". So stop posting "gimme money" in every topic. What was in past (that is, 4 years ago) is still present... people don't change to stop helping others. Even SA-MP forum has people who loves to make scripts that people asked for.
  20. 50p

    GUI problem..

    That's why use my GUI classes where you don't have to worry about addEventHandler and all its parameters, just AddOnClick( funcName ).
  21. 50p

    GUI problem..

    There is no such function client-side. http://development.mtasa.com/index.php?title=GiveWeapon BTW, if you want to create GUI easier then try my GUI lib created specially for you! You will find it easy. You won't have to use addEventHandler but :AddOnClick. Your code would look like this: function hide( ) myWnd:Visible( false ); showCursor( false ); end function createWindow( ) showCursor( true ); myWnd = Window:Create( .08, .18, .2, .3, "BUY MENU", true ); buym4 = myWnd:AddButton( .05, .1, .3, .1, "M4", true ); buyak = myWnd:AddButton( .05, .2, .3, .1, "AK47", true ); buyde = myWnd:AddButton( .05, .3, .3, .1, "Deagle", true ); buypi = myWnd:AddButton( .05, .4, .3, .1, "Pistol", true ); buysi = myWnd:AddButton( .05, .5, .3, .1, "Silenced", true ); buymp = myWnd:AddButton( .05, .6, .3, .1, "Mp5", true ); buysn = myWnd:AddButton( .05, .7, .3, .1, "Sniper", true ); exitBtn = myWnd:AddButton( .05, .8, .3, .1, "Exit", true ); exitBtn:AddOnClick( hide ); -- size for AddLabel() is not required because size will be as big as text size myWnd:AddLabel( .4, .12, "$2000 for 50 bullets", true ); myWnd:AddLabel( .4, .22, "$2000 for 40 bullets", true ); myWnd:AddLabel( .4, .32, "$750 for 90 bullets", true ); myWnd:AddLabel( .4, .42, "$750 for 140 bullets", true ); myWnd:AddLabel( .4, .52, "$750 for 120 bullets", true ); myWnd:AddLabel( .4, .62, "$1000 for 90 bullets", true ); myWnd:AddLabel( .4, .72, "$1000 for 100 bullets", true ); end addCommandHandler( "gui", createWindow ) I'd recommend binding key for showing hiding the GUI and create the GUI when resource starts.
  22. You don't ask your girlfriend to have sex and pay for it, do you? You don't ask MTA developers to add specific feature and pay them if they'll make it, do you? As someone here said, there are different kinds of people. Some people don't mind, some people do. I've made many things for free and never asked for money, why? Because I was born to help people even if I have to do something for them. Maybe some day I will need help and someone will help me.
  23. So why do you talk about money if you don't know what he wants? Maybe it's just 10 lines of code.
  24. What is the "Message Bar"?
  25. You haven't try this. Why I know that? Because it doesn't matter where you put this code, it'll get all the players that are online and loop through them.
×
×
  • Create New...