Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. I would suggest you leave this script somewhere in your mind only.. Trains have never worked properly and they have to be synced by at least 1 player.
  2. I suppose they created an image for every digit and render the image of the specific digit. I'm working on a patch to add custom fonts function for MTA but I doubt it'll be added to MTA, like most of my patches lol
  3. Maybe map name and game type are set by mapmanager when your resource starts. Try onGamemodeStart if your resource is a gamemode.
  4. 50p

    Problem reSpawn!

    Because spawnPlayer has default values and skinID is 0 (CJ). You can easily fix it by using player's current skin (getElementModel).
  5. Is the rest of the code working? If not, use getResourceRootElement( ) instead of resourceRoot (if resourceRoot hasn't been defined).
  6. 50p

    random text

    Why do you expect it to generate string with 5 characters if you only want it to generate string with 1 or 2 characters? Make a separate function for generating string. Also, is the string going to be the same for everyone? If so, why don't you make a global variable? function generateRandomString( charsCount ) local str = ""; for i = 1, charsCount do local c = string.char( math.random( 100, 122 ) ); if i % 2 == 1 then c = string.upper( c ); end str = str .. c; end return str; end addCommandHandler( "reac", function( _, _, count ) WIN_WORD = generateRandomString( tonumber( count ) or 5 ); -- eg. "/reac 6" to generate 6 characters string outputChatBox("Reaction: Type '".. WIN_WORD .."' if u want to win $10000",getRootElement(),0,255,0); end, true -- restricted for admins only (you'll need to update ACL to restrict it) ); addEventHandler( "onPlayerChat", getRootElement(), function( msg, msgType ) if msgType == 0 then if WIN_WORD and msg == WIN_WORD then WIN_WORD = nil; outputChatBox( getPlayerName( source ) .. " has won $10000 for quick reflex!", getRootElement(), 0, 255, 0 ); givePlayerMoney( source, 10000 ); end end end )
  7. 50p

    carcols.dat

    Is is so hard to understand?
  8. As stated long time ago, use client-side scripts only for visuals (GUI) and custom models/textures (engine functions) if possible.
  9. If you want me to be honest then I'll say it takes way TOO MUCH space of screen. At first it was very hard to figure out what time is what - so many digits next to each other. I like games with as minimal HUD as possible but show it only when it's required (like when player finishes a lap or race or reaches a checkpoint).
  10. 50p

    Aircraft Carrier

    So? It's right. I attachel the element one whit the other element. Well, first, try to find attachElement on wiki I can't find such function. Then look at attachElements wiki page. It's not right... Read your code and wiki carefully. Check your 1st attachElement call and wiki.
  11. 50p

    carcols.dat

    Just because there are 126 colours doesn't mean you can't use higher values for colours. You can find loads of interesting colours above number 126 and I'm pretty sure there is orange.
  12. @MaddDogg Read more about addEventHandler, please. @jkub I would suggest you use table but have it in server-side script instead of client-side because if client will hack your script somehow he'll be able to change the coords to whatever value he wants therefore spawn anywhere. Then just triggerServerEvent with the "id" (row number) of the selected spawn location. I wonder why you don't know anything about tables yet. Anyway, as MaddDogg said, you could use row id to identify spawn location in a table, something like this: local spawnLocations = { { 1234.5678, 1.58, 10, 0 }, -- table 1: x, y, z, rotation { 123.5678, 14.5678, 11, 0 }, -- table 2: x, y, z, rotation { 12.5678, 134.57, 12, 0 }, -- etc. { 1.5678, 1234.568, 13, 0 }, -- etc. }; -- this table has a set of tables of spawn coords which you can use easily -- lets say selectedRow will be 2: selectedRow = 2; -- you send row id with triggerServerEvent and use it instead of the 2 -- this will take data from table #2 from the spawnLocations table above x = spawnLocations[ selectedRow ][ 1 ]; -- x of selected spawn location (123.567) y = spawnLocations[ selectedRow ][ 2 ]; -- y ... (14.5678) z = spawnLocations[ selectedRow ][ 3 ]; -- z ... (11) r = spawnLocations[ selectedRow ][ 4 ]; -- rotation ... (0) -- You can assign the values from table to a variable if you don't want your spawnPlayer function to be very long But still, I don't see any problem with your script... What is your client-side event "playerSpawnedComplete" for? May it cause any problems? Show us.
  13. We don't know much about your problem without more code... You just showed a little piece of code that spawns player after 1 sec., fades camera in/out and triggers client event. I even wondered why you checked if player is at 0,0,0 before he was spawned. Also, why do you set a timer? You can spawn the player and fade camera in at the same time. Besides, you don't need your arguments in your fadeCamera (line 5) apart from client and false because rest of your arguments are the same as default parameter values. Don't forget to debug your script.
  14. Are you trying to convert name to a number? You have to modify rest of the script to work the way you want... It won't start working just because you put name in there...
  15. Because the data has to be string not an element. You probably get a warning message in your debug window if you use something else than string. Either use their names or account name or ID if you have an id system.
  16. guiGridListSetItemData ( GUIPopupGrid_Grid, row, 1, tostring ( player ) ) This is the problem... Do you have any idea what tostring does? Or what tostring( player ) will return? Then go and check it for yourself.. Don't expect me to spoon feed you this information. Other scripts work because you probably convert a number to a string which you then convert back to a number.
  17. To me it looks like you try to convert selected a string like: "userdata: " to a number which is never going to work because tonumber will not convert "userdata: " to a number.
  18. What's thisPlayer? And what error are you talking about?
  19. It creates 3 bots because you start 3 resources. addEventHandler to getResourceRootElement not getRootElement otherwise the function will be called every time you start a resource (any resource).
  20. 50p

    carcols.dat

    Well, then you 1-don't read posts carefully and/or 2-have no idea what the file is for and/or 3-are too lazy to check the file yourself.
  21. Are you sure nemesis (one of spawnBot function arguments) is a team element? Well, it doesn't matter that much but is the bot created? Don't you get any error/warning message? "/debugscript 3" remember this command.
  22. 50p

    Aircraft Carrier

    You must have misread attachElements documentation. I'm pretty sure, first parameter is the object that you are attaching and second parameter is the element that other element (1st param) is being attached to.
  23. 50p

    carcols.dat

    Who is talking about collision? @ XFawkes You can't change data files and won't be able to. What do you need it for anyway? You can change vehicle colours with scripts.
  24. Do you get any error/warning messages? I'm pretty sure you do about event not being added on client's side. I would NOT recommend creating stuff outside a function. Create ped and train inside onResourceStart event and/or triggerClientEvent after player has downloaded the resource.
  25. You explained what your problem is, you know what is causing it then why did you ask us here if you know everything you need to know to fix it yourself? BTW, never ever check if coords are equal to some specific number, like if x == 0 and y == 0 and z == 0 then because they will never be equal to 0. Basically, never compare float numbers.
×
×
  • Create New...