Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. You can always use getPlayerUserName and getClientIP istead and make your own banning system.
  2. You don't have to loop through "vehicle". Such feature is built in MTA. You just create something similar to what you posted, but instead of x, y, z, rotx, rotx, rotz, you use posX, posY, posZ, rotX, rotY, rotZ and change the to . Also, just add the file to meta.xml as . That's all you need to do, server will create the vehicles when resource starts.
  3. Triple post! Use "Edit" to edit your posts! It wouldn't fade camera for all the players when resource start. Source of onResourceStart is resource that started, so you can't fade resource's camera, it must be player. Some functions allow getRootElement() as an argument and it would do something to all the players (like, outputChatBox( "hello", getRootElement(), 200, 200, 200 ), it would output "hello" to all the players) The most important thing is: Try to avoid naming parameters source! If you call a function from an event, the "hidden" variable source will be passed to that function, so which source is source? Eg. addEventHandler( "onPlayerJoin", getRootElement( ), function( ) greetPlayer( ) end ) function greetPlayer( ) outputChatBox( "Welcome to my server ".. getClientName( source ), source ) end As you can see, I did not pass any variables to greetPlayer function, just because it's not required if you call a function from event. Source will be the same as in the event. So it might be confusing for you and the Lua parser. With the similar example: addEventHandler( "onPlayerJoin", getRootElement( ), function( ) greetPlayer( getResourceRootElement( getThisResource( ) ) ) end ) function greetPlayer( source ) outputChatBox( "Welcome to my server ".. getClientName( source ), source ) end Do you know which source is the "hidden" source (player) and resource root element? That's why I recommend naming parameters what they are, like player, vehicle, resource or something else, NOT source! It's basically what Gamesnert said, but he didn't say (maybe he didn't know that yet), that "hidden" source is passed to a function, even if that function is not attached to the event.
  4. 1st: These are not errors! They are just warning messages telling you there is a bad argument passed to the function. 2nd: From the function [uVA]Bart posted above this post I assume that SlrPlayer must be root xmlnode of the xml file that players are stored in and file format must be like this: <file> <User Serial="xxxx-xxxx-xxxx-xxxx" /> </file> If that's how the file looks, you should get that warning message if SlrPlayer was not xmlnode. 3rd: I haven't seen code of that resource but I'm sure you should be able to get rid of that message with simple if statement.
  5. You can take a look at this resource: https://community.multitheftauto.com/index.php?p= ... ils&id=124 Or search this forum (I'm sure there was a script with command to save coords for vehicles too).
  6. AFAIR, this is "misspelt". Probably MTA had xmlNodeFindSubNode in past and then it was changed to xmlFindSubNode, though the message wasn't changed and it shows the old message. I guess he uses xmlFindSubNode because you wouldn't get "Bad argument" warning message if the function you wanted to call doesn't not exist. And Fatscrilla, if it doesn't cause you any problems, don't worry about it It could be fixed though, with simple if statement.
  7. The resource must be running to call functions from it. You don't have to include the resource into meta.xml but it must be running. You can add the helpmanager to the list of resources which start with the server and you won't have to include it into meta.xml either.
  8. No, probably in dp4 or 1.0, but it's not sure yet.
  9. This command will strip all vehicle's doors you are a driver of: addCommandHandler( "strip", function( player ) local playerVeh = getPlayerOccupiedVehicle( player ) if playerVeh and getVehicleOccupant( playerVeh, 0 ) == player then for i = 1, 4 do setVehicleDoorState( playerVeh, i, 4 ) end end end )
  10. 50p

    Random Number

    vehicles = { 560, 444, 459, 590 } rnd = math.random( 1, #vehicles ) createVehicle( vehicles[ rnd ], 0, 0, 4 )
  11. Yes, robhol. -- lets say we have this function: function funcName() outputChatBox( "Hello world" ) end _G[ "funcName" ] - returns the function type variable, they are used the most for attaching function to event, like: addEventHandler( "onPlayerJoin", getRootElement( ), _G[ "funcName" ] ) -- 3rd param in addEventHandler must be a function, so this returns the function _G[ "funcName" ]( ) - calls the function addEventHandler( "onResourceStart", getResourceRootElement( getThisResource( ) ), function( ) _G[ "funcName" ]( ) -- now you call the function, so it will output "Hello world" in your chatbox end ) You can pass arguments too: _G[ "funcName" ]( "hello world", 1, false ) or whatever you like.
  12. 50p

    Radar Area

    Why do you take weapons from everyone when someone leaves the area?
  13. Or when community site will be up again try this: https://community.multitheftauto.com/index.html?p ... ails&id=38
  14. Mr.Henkey, it will set all the objects to dimension 1 not only those from specific map file.
  15. accountdat It seems to be accountdat[ 0 ] at the first time loop. Try to outputChatBox (or print, whatever) the data that was read from the xml file.
  16. Probably because accountdat was not defined as a table. accountdat = { } Also, remember, table index does not start from 0, therefore table[ 0 ] is wrong.
  17. If you don't know if the content of an XML file is correct, use this validator: http://www.w3schools.com/Dom/dom_validate.asp
  18. 50p

    [REQ]RPG Gamemode

    If this is your first programming language then it will be a bit difficult for you to learn. It won't take a few hours, but days maybe even weeks to get into it.
  19. That's why you should toggleCameraFixed mode and then add handling function to onClientRender, so it shouldn't be looking in the wrong direction. I've played with cams a bit too. I can't remember when exactly but when I tried to set camera position for the 1st time it was set to 0,0,0 but the next time camera was set to the position that was previously called. It was set to the previous position every time after that.
  20. TBH, I've never stumbled on such issue. I've had camera rotating around a player and I could walk normally, I could enter a vehicle and drive it with rotating camera.
  21. What camera do you think about? Do you mean "cinematic" one which changes from time to time? Maybe in dp3 it would look smoother (using onClientPreRender) then in dp2 (using onClientRender).
  22. 50p

    Call problem

    1 advice: Try to avoid using "source" as a parameter especially in functions that are attached to events. It may lead (you and the script) to confusion. You triggerServerEvent with arguments: player, vehicleID, player Function in server-side script gets only 2 of them, vehicleID and player. source in handleVehicleCreation will be vehicleID and vehicleID will be player. Try to fix it by removing source from argument list in handleVehicleCreation. Read more about events and how they are triggered. You don't have to use player element in argument list if source will be the player element, unless you want to pass other player element. If you don't want to challenge yourself try this: http://pastebin.com/f3b49481d
  23. 50p

    particle.txd

    It's not possible. AFAIK engine functions works on files from gta3.img.
  24. Add false as the last argument in addEventHandler, like so: addEventHandler ( "onClientGUIClick", ButtonOK, CloseOKguiAdminPanel, false )
  25. Store them in an XML file(?)
×
×
  • Create New...