Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. the server's side looks okay, how's the client's side? And why aren't you doing it on the client's side anyway? Much easier to do and no hussle with weird triggers and such.
  2. It's all about the logic behind it, put down on a piece of paper what you want to display and what you want to add/remove. Once you've got that, create it piece by piece. km state should be something with elementData, same goes for indicators. If you're stuck with a part of the script, make sure to come back here and we'll help you with what you've tried. (:
  3. to go a bit more into detail, playing a song is the same for files as in links. Make sure you can listen to the mp3 on the link and then replace the songname in playSound with the link. Something like this: local sound = playSound ( "http://example.com/song.mp3" );
  4. That's the same error, just about this piece; if not dispatchTable[processedName] then dispatchTable[processedName] = { } end Add a new check in there to see if you actually got a processedName before trying to create a table for it. Also, make sure that you're actually putting something in the processedName because it might give you unexpected results.
  5. You can always create yourself a custom map manager which spawns the objects for maps by using a script ( using a loop and createObject ) to take out map files. Same can be done for music, you can either stream it with playSound or download them in the background. I would go for streaming it though.
  6. The script is telling you that processedName is nil. You're trying to assign/call a table's key as a nil value. First try to see if processedName isn't nil, if it's not, then get the type. Something like this would do; replace; if type(dispatchTable[processedName]) == "table" then with; if processedName and type(dispatchTable[processedName]) == "table" then
  7. tosfera

    Few questions.

    Listen, you started to annoy me. Got answer put it on, don't have then keep silence. All you do is wasting time and giving no useful :~ at the end. I've given the answers, you asked how to do something, I told you what kind of functions you would need. No way that I'm one out of the 10 losers on this forum which is seriously just giving out scripts to people who keep requesting it and not getting proper credits for it. It's a forum to support you when your script is being a total b!tch, not a thing where you can randomly ask around to get sh*t done without moving your lazy fat ass.
  8. You can do that with a ternary statement. That'll keep it smaller, like so; outputChatBox ( "cuenta: ".. account .." TEXTO: ".. ( text and text or "N/A" ) ) This actually says; if ( text ) then text or "N/A". So, if the text isn't false ( so it has some data ), it'll add the text after that outputchatbox. Else it'll add "N/A".
  9. They recently added it? and when it got removed? as stated here; https://bugs.mtasa.com/view.php?id=4571 they never managed to fix some bugs and therefore has been removed from the core of MTA again.
  10. it's quite simple; local allAccounts = getAccounts(); for i = 1, do -- you can simply say getAccountData ( allAccounts [ i ], "key" ); end
  11. if elementMoney == itemMoney then this returns false, which is also weird. They are both integers. I do have to test this one when I get home, will get back to you once I have it. if tonumber(tostring(elementMoney)) == tonumber(tostring(itemMoney)) then
  12. use GetAccounts to get the accounts, after that loop over the accounts with a simple; "for i = 1, #var", use getAccountData to see if the player has that data.
  13. So comparing numbers is just a no go in lua? Strings all the way?
  14. tosfera

    Few questions.

    There are alot of examples at the wiki, check the link in below. Click_Here! If i understood it, what i am doing here? wasting time? Basically, we're answering your questions. This part of the forum is for support in scripts you made. Not to request things. If you're just requesting examples, yes. You're wasting your time.
  15. Custom animations have been removed from MTA since it bugged out everything. They never managed to fix it.
  16. First of all, if you're using mysql. don't overuse the connection. Only use it for login systems, to get and save data. Only at resource start to keep it really nice. ipairs are no big deal, as long as you use 'return' or 'break' once you've got the data you need. Something else for this can be; if you're looking for a specific vehicle, give the vehicle an ID with setElementID and parse the ID to the function and use getElementByID to speed up the progress of getting the vehicle. getElementsByType, if you're doing it with objects etc, include the resource's name after the type. This'll make sure the function only takes the objects created by that resource and not the map files etc. Colshapes are fine, so is element data. Just make sure you don't share everything with the client. setElementData sets data on the element and uses a trigger towards the client to share this data. Quite hard if you're doing it with fuel systems or health status things every 50ms.
  17. I've got some proper brainf*cking material right here. I'm comparing someone's money ( both int values ) and the debugs are outputting the same values. By using tonumber the results end up being false. If I change them to a string, it works. The debugs below are the results including their type; number type; check: false value1: 695.41000000001 [type] number value2: 695.41000000001 [type] number string type; check: true value1: 695.41000000001 [type] string value2: 695.41000000001 [type] string The check goes as following; if ( tonumber ( elementMoney ) == tonumber ( itemMoney ) ) then -- returns false if ( tostring ( elementMoney ) == tostring ( itemMoney ) ) then -- returns true Why in seven hells is the check going wrong if I'm parsing them to a number but works if I parse them to a string?
  18. First of all, what a mess. Sorry to say, try to use tabs at every new line to see what's inside a block. Try something like this; addEvent ( "reward4", true ); addEventHandler ( "reward4", root, function ( thePlayer ) if ( thePlayer == getLocalPlayer() ) then if ( guiGetVisible ( mis4 ) ) then guiSetVisible ( claim4, true ); guiSetVisible ( change4, false ); fadeCamera ( false, 0, 0, 0, 0 ); sound = playSound ( "song.mp3" ); else guiSetVisible ( claim4, false ); guiSetVisible ( change4, true ); end end end ); function Finsh_Missoin ( thePlayer ) if ( thePlayer ) then dropMarker = createMarker ( 858.14453, -587.89142, 18.01809, "cylinder", 7, 255, 255, 0, 100, thePlayer ); dropBlip = createBlip ( 858.14453, -587.89142, 18.01809, 24, 5, 255, 255, 0, 255, 1, 900000, thePlayer ); addEventHandler ( "onMarkerHit", dropMarker, function ( hitElement ) if ( hitElement == thePlayer ) then triggerClientEvent ( "show4", thePlayer, thePlayer ); triggerClientEvent ( "reward4", thePlayer, thePlayer ); end end ); end end
  19. That part should work now. It shouldn't give you the error now.
  20. What is this? An "else" is a part of an if-statement and is totally random there, it doesn't even make sense.
  21. How are you triggering the "reward4" event? You said something about a marker, can you show us that piece?
  22. You would have to split the text indeed, you could add teamnames in a string like; team1,team2,team3. Use the split function to get the teams and see if one of the teams is assigned to the player.
  23. As an easier thing; just make the vehicle damage proof when the health drops below 400.
×
×
  • Create New...