Jump to content

TheMtaUser555

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by TheMtaUser555

  1. thanks, that worked. I tried using string.find before but it didn't work, I guess it was because I didn't cancel the event
  2. Nothing happens when I try this ( it's supposed to remove all the HEX code ): addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick) if string.find( newNick, '#%x%x%x%x%x%x') then setPlayerName ( source, oldNick ) end end ) I also tried to use gsub and then setPlayerName, put it spams the chatbox.. Any help would be appreciated
  3. I want to prevent the race mode from launching the race, until everyone finishes downloading the files. How can I do this? Is there any function that returns the download state or something? because some custom maps are really big..
  4. i've tried that, if you read it again it says: This is the point in time at which the vehicle last exploded so not really what I'm looking for, thanks for trying anyways
  5. like, when the car gets on fire..I tried on client render, and triggering it serverside, so each time it went lower than 249 of health it would set it back to 230. but it still explodes I saw something like this on a server, I think it was saes rpg, when the car was on fire, it would last for about 5 minutes and then explode
  6. I tried this, but it didn't work ( I get "nil" ) : function maxMoney() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do currentCash = getElementData ( thePlayer, "money" ) if currentPlayer() and currentCash > storedCash then currentPlayer(thePlayer) end winner = storedPlayer end end function currentPlayer(source) storedPlayer = source storedCash = getElementData(storedPlayer, "money") end
  7. hi, I want to get the player that has the most cash, from the scoreboard. The problem is I don't know how to do it. Can someone explain or show me how to do it? please and thanks. function maxMoney() local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do tableMoney = getElementData ( thePlayer, "money" ) winnerMoney = math.max(unpack({tableMoney})) end end
  8. @Solidsnake14 got the same result (but 160/161kph this time), I guess it's bugged, or something else must be done. Thanks anyways
  9. read the wiki, it says : velocityX: the X velocity of the source before the collision took place velocityY: the Y velocity of the source before the collision took place velocityZ: the Z velocity of the source before the collision took place
  10. I got my other scripts to work, so I think it should be okay if I asked for some help here. I want to get vehicle's speed before he hits another vehicle, the problem is, it always returns the same speed (180 or 179kph), no matter how fast or slow I'm going. What I'm doing wrong here? https://wiki.multitheftauto.com/wiki/OnC ... eCollision function collision(collider,force, bodyPart, x, y, z, vx, vy, vz) if (getElementType (collider) == "vehicle") and (source == getPedOccupiedVehicle (getLocalPlayer())) then actualspeed = (vx^2 + vy^2 + vz^2)^(0.5) kmh = actualspeed * 180 outputChatBox(kmh) end end addEventHandler("onClientVehicleCollision", root, collision)
  11. This is the gamemode: When the crook reaches a certain distance from the cop vehicles, the server should output a message saying "Escaped". And OnClientVehicleStartEnter didn't solve the problem, because this is played on Race gamemode But thanks anyways. if anyone knows how to fix it, please help me.
  12. What about fDistance = getDistanceBetweenPoints3D ( fVehicleX, fVehicleY, fVehicleZ, fX, fY, fZ ) ? isn't it global? I need it to get the distance between the cars, I know what it does. I just wanted to output the message once, which I guess it isn't possible with the clientrender event
  13. It's a client side script. The script should get all the vehicles and skip the crook vehicle (non police car), then get the distance between the police vehicles and normal ones and if the distance is more than 1000, output a message. The error : "lua:27: attempt to compare nil with number" So for some reason I keep getting a nil value on the distance, also how can I make it output only one message, so it won't spam the chat after each frame. policeVehicles = { [416]=true,[574]=true, [433]=true, [427]=true, [490]=true, [528]=true, [407]=true, [544]=true, [523]=true, [598]=true, [596]=true, [597]=true, [599]=true, [432]=true, [601]=true, [428]=true, [497]=true, [510]=true, [564]=true} function enter(theVehicle,seat) copCar = policeVehicles[getElementModel(getPedOccupiedVehicle(getLocalPlayer()))] if not copCar then for iCount = 1, #getElementsByType 'vehicle' do if ( getElementsByType 'vehicle' [ iCount ] == getPedOccupiedVehicle ( getLocalPlayer() ) ) then doLoop ( iCount + 1, getLocalPlayer() ) pVehicle = getElementsByType 'vehicle' [ iCount ] fX, fY, fZ = getElementPosition ( getLocalPlayer() ) fVehicleX, fVehicleY, fVehicleZ = getElementPosition ( pVehicle ) fDistance = getDistanceBetweenPoints3D ( fVehicleX, fVehicleY, fVehicleZ, fX, fY, fZ ) outputChatBox( fDistance ) getDistance( ) end end end end addEventHandler ( "onClientPlayerVehicleEnter", getRootElement(), enter ) function getDistance( ) if ( fDistance <= 1000) then cancelEvent() else outputChatBox( "Escaped" ) end end addEventHandler ( "onClientRender", getRootElement(), getDistance )
  14. I guess both of us end up learning something! and thank you Kenix
  15. finally, it's working! Thanks, I learned alot from this!
  16. so, the source is my player? I tried this : local iX, iY, iZ = getElementPosition (getPedOccupiedVehicle ( source ) ) but the values are almost the same as the other ones, it still says there are vehicles around me
  17. 3553.3244846787 247.96236788842 0 i used this: outputChatBox(tostring(fDistance)) edit: the other player ( virtual machine) was at the start line, far enough and i tried at a close distance, 3553.4269125745 0
  18. i'm not sure what do you mean, but when i reach the second checkpoint it outputs the text, even though there are no vehicles around my car, i tried with more than one players online and without anyone. It should disable the ghostmode. It doesn't show any kind of erros on debug mode, sorry but...as you see here, i'm a noob at this
  19. I re edited but the problem still remains, no erros at all, the script seems to be including the source vehicle too, how can I make it ignore addEvent ( 'onPlayerReachCheckpoint', true ) addEventHandler ( 'onPlayerReachCheckpoint', root, function ( eCheckpoint ) if ( eCheckpoint == 1 ) then outputChatBox ( '#FF0000Disabling GhostMode at the next checkpoint!', source, 255, 255, 255, true ) end if ( eCheckpoint == 2 ) then local fX, fY, fZ = getElementPosition ( source ) for _, pVehicle in ipairs ( getElementsByType 'vehicle' ) do local fVehicleX, fVehicleY, fVehicleZ = getElementPosition ( pVehicle ) local fDistance = getDistanceBetweenPoints3D ( fVehicleX, fVehicleY, fVehicleZ, fX, fY, fZ ) if ( fDistance <= 20 ) then outputChatBox ( '#FF0000players around!', source, 255, 255, 255, true ) return end end setElementData ( source, 'overrideCollide.uniqueblah', 255, false ) setElementData ( source, 'overrideAlpha.uniqueblah', 255, false ) outputChatBox ( '#FF0000GhostMode has been disabled!', source, 255, 255, 255, true ) end end )
  20. Everything works fine except the part when we reach a certain checkpoint with vehicles around the player..The ghostmode should be enabled until nobody is around. It just doesn't work..The ghostmode disables no matter the distance between vehicles. Please help me out here, thanks. the script :
  21. Well I'm currently hosting a server at no1servers, it's only for weekly events ( once a week ), it has 25 slots. The problem is it always has a problem every week..It's not a big deal to me but sometimes it's down at the day of my event. I found a cheaper game server hosting, it's called GameServers4You, I tested one of their servers and it runned pretty smooth. Now I would like to know if it doesn't have that many downtimes as no1servers. no1servers is moving their gameservers to netherlands in a few days, for a better connection. Pings were also a problem, players had an average ping of 130 ( probably because most of them live in europe), the server is located in USA atm. How good is GameServers4You? is it better than no1servers? Both have pretty much the same specs..But GameServers4You seems cheaper.
×
×
  • Create New...