myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
40
Everything posted by myonlake
-
I don't think the idea makes much sense, it could be a lot simpler by just making a element data check on whether the team or team name is the same as the player entering the vehicle, this way you won't get any issues between other radar areas and such, but uh, as you want it, here you go. Server-side createRadarArea( 110.91990, 1800.89435, 200, 145, 255, 255, 255, 225 ) -- Create a radar area local customVehicle = createVehicle( 487, 251.64256286621, 1920.413574218817, 64.0630722046, 0, 0, 0 ) -- Create a vehicle setElementData( customVehicle, "vehicles:custom", 1, false ) -- Set the element data on vehicles:custom addEventHandler( "onVehicleStartEnter", root, -- Initialize an event handler on when a player starts to enter a vehicle function( enteringPlayer ) if ( not getElementData( source, "vehicles:custom" ) ) or ( tonumber( getElementData( source, "vehicles:custom" ) ) ~= 1 ) then return end -- Check if the vehicle has vehicles:custom data local x, y, z = getElementPosition( enteringPlayer ) -- Get the position of the entering player local foundArea -- Initialize a variable with nil value representing a radar area for _,radarArea in ipairs( getElementsByType( "radararea" ) ) do -- Loop through all the radar areas if ( isInsideRadarArea( radarArea, x, y ) ) then -- If the player is inside it foundArea = radarArea -- Set the found area as this radar area that we were just checking break -- Break the loop and continue end end if ( foundArea ) then -- If we found a radar area local playerTeam = getPlayerTeam( enteringPlayer ) -- Get the player's team if ( playerTeam ) then -- If the player is in a team, then continue local r, g, b = getTeamColor( playerTeam ) -- Get the team's color local aR, aG, aB = getRadarAreaColor( foundArea ) -- Get the found radar area's color if ( r ~= aR ) or ( g ~= aG ) or ( b ~= aB ) then -- Check if the colors don't match each other outputChatBox( "[bASE] Your gang hasn't bought this base.", enteringPlayer, 0, 0, 0, false ) -- Output a warning message to the entering player cancelEvent( ) -- Cancel the event and don't let the player enter end end end end )
-
It's not stealing or cloning, it's simply how things are nowadays in this century, as it seems lobby gamemodes have become a trend in racing. Back in the day there were no lobbies, now that the software is more stable and more functions and features have come up, making a lobby is possible and indeed a great choice instead of having 5 race servers for individual gamemodes. Of course always it is preferred if you can take that idea and develop it further, perhaps even better than what the servers currently have.
-
He probably means motorcycles. You can use the following code to disable passengers on bikes. Server-side addEventHandler( "onVehicleStartEnter", root, function( _, seat ) if ( getVehicleType( source ) == "Bike" ) and ( seat > 0 ) then cancelEvent( ) end end )
-
I don't think you should help anyone as you can't fix your own mistakes and don't know what a variable is and how it's used.
-
I think it will be a big project to make it work. You need to replace models, textures, perhaps even remove world models and such. There is also the object limit problem eventually, so you'd have to use Eir for that. Eir is probably the thing you are looking for, I doubt you can make it work so well on vanilla.
-
You're welcome. The biggest issue in the world of programming are the smallest mistakes we make. I've spent days trying to find out a reason for a problem myself in Ajax and PHP data transfer, there are no errors either even though all debugs are on and logging, still no errors outputted, so yep, it's always good for someone else to have a look at the code because people spot different type of things.
-
You don't need the data check. Also, you have a typo in the setElementData part. setElementData(ped,"ped_id",curentID) 'curentID' should be 'currentID'. Remove the 'local data' part as well, it doesn't return anything except a boolean and it always returns true as long as your arguments are valid, which in this case are not, because of the typo.
-
You can always pass each shot through the server and wait for the targeted client to get the bullet. Obviously as we all know, this will require a lot from the server since it synchronizes each shot. I really don't think it's worth making, because you can never balance it enough well. As you can't force synchronization through server and client connections, it will be impossible to avoid cheaters cheat their way through. However, I think he wants a system that will show each hit on the screen, so there's no need to think about hit synchronization, just simply a red fade in/out effect whenever you get shot. That's what he means, most likely.
-
You can use the below code to format milliseconds to days, hours, minutes and seconds. function formatMilliseconds(milliseconds) local totalseconds = math.floor( milliseconds / 1000 ) milliseconds = milliseconds % 1000 local seconds = totalseconds % 60 local minutes = math.floor( totalseconds / 60 ) local hours = math.floor( minutes / 60 ) local days = math.floor( hours / 24 ) minutes = minutes % 60 hours = hours % 24 return string.format( "%03d:%02d:%02d:%02d:%03d", days, hours, minutes, seconds, milliseconds ) end You can use a timer so, that it goes through all the players at once, so that you won't have to define a timer on each player. Of course making it client-side would reduce any server-side lag, so I suppose you can use a timer. You can also use getTickCount do that, so it's up to you.
-
You're welcome if you even opened the links I gave you. Good luck...
-
Feel free to learn scripting by reading the following sources. https://wiki.multitheftauto.com/wiki/Server_Manual https://wiki.multitheftauto.com/wiki/Resources https://wiki.multitheftauto.com/wiki/Sc ... troduction viewtopic.php?f=148&t=40809 If you can't get it to work, I would give up hope if I was you, sorry. Scripting isn't for everybody and it seems it's hard for you to understand what a variable is and how you can use it even though I have given you three links to the variable manual that is very easy to catch and learn. Same goes to element data, which I am using in the code I posted above. Again, if you don't understand the way it works, I'd stop and read the manuals above. Please stop asking and make them yourself.
-
Fine, since neither of you can script anything. Client-side function drawSeeds( ) dxDrawText( "Seeds: " .. getElementData( localPlayer, "job:seeds" ), 0, 0, 100, 60, tocolor( 255, 255, 255, 255 ), 1.0, "default-bold", "left", "top", true, false, true, false, false ) end addEventHandler( "onClientResourceStart", resourceRoot, function( ) addEventHandler( "onClientRender", root, drawSeeds ) end ) Server-side local seedMarker = createMarker( 0, 0, 3, "cylinder", 1.5, 220, 160, 20, 180 ) local maxSeedAmount = 50 function getSeedAmount( player ) if ( not player ) or ( not getElementType( player ) ~= "player" ) then return end return ( getElementData( player, "job:seeds" ) and tonumber( getElementData( player, "job:seeds" ) ) or 0 ) end function setSeedAmount( player, amount ) local amount = tonumber( amount ) if ( not player ) or ( not getElementType( player ) ~= "player" ) or ( not amount ) or ( amount and amount < 0 ) then return end setElementData( player, "job:seeds", math.min( maxSeedAmount, amount ), true ) return true end addEventHandler( "onMarkerHit", seedMarker, function( hitElement, matchingDimension ) if ( getElementType( hitElement ) ~= "player" ) or ( not matchingDimension ) then return end setSeedAmount( hitElement, getSeedAmount( hitElement ) + 1 ) outputChatBox( "You picked up one seed.", hitElement, 20, 245, 20, false ) end )
-
Because you aren't using a variable nor element data. Like I said, use either of them.
-
No. You cannot manage MTA internal commands, because that would be a big security issue.
-
If you can make that much code, I am sure you can make a variable or element data as well. Try to do it and if it doesn't work, let us know.
-
Read the links that I posted.
-
You can use an array instead. Initialize an array and each time a player joins, insert the player to the array and when they leave, null the array value.
-
You can use interpolateBetween to make a smooth movement between two coordinates. You can also alternatively use smoothMoveCamera if you want to, it's not too efficient when comparing interpolateBetween however, because it creates an unnecessary object and moves the object instead of the camera coordinates. With interpolateBetween you can drop the object and just move the camera, this way you have one less thing to do and practically is faster and more trustworthy.
-
I don't understand what you want. Can you explain a little bit more on why you want it and how you want it.
-
And I don't understand what you mean by them being in dying animation and not disappearing. If you really want to force-delete the dead pedestrians, you can use destroyElement and loop through all dead pedestrians.
-
That doesn't make any sense. Lua always returns either a float or an integer when talking about numbers, there are just two types. SQL databases have many different types of different uses. I am not sure how long the return of getTickCount is, but I assume if it's over 10 characters long, you've got to use a big integer or so.
-
Well, not sure how that could work anyhow, it's practically the same as using guiSetFont I think you'll just have to loop through all labels and set their font. You can use a for loop and check for gui-label elements and then just set the font with guiSetFont.
-
Nice job. A very handy tool for converting maps indeed.
-
I think you can force font changing by for looping through all GUI label elements and then setting their font to whatever choice you want to set it to. It's a bit more difficult with DirectX texts however, if you're using those. You could make your own font handler resource and just export a font function that sets the font to whatever you want, this way you have easier management over all fonts, I'd guess.
-
Remove cindex from getNearbyCorpses. Arrays are automatically pushed and you won't have to define the key manually. If you want to erase the array, you can just empty the array with curly brackets, but as the array is defined locally, you won't have to worry about erasing anything. This might be the solution for the issue. Also, when you incremented cindex variable, it was set to local, so it never actually increased the value because it was unset after the round was completed.