csiguusz
Members-
Posts
500 -
Joined
-
Last visited
Everything posted by csiguusz
-
Hm? What kind on animation do you mean?
-
@Cadu12: the first function that i wrote here can only be used on client-side. With a little modification (what i did now) it's working on server-side too.
-
Because i have a lot of time now, a made it! This should work on server-side. But i think it would be better to get the nearest veh on client side, because so many calculations can have an impact on the server's performance. function getNearestVehicle( player ) local x, y, z = getElementPosition( player ) local prevDistance local nearestVehicle for i, v in ipairs( getElementsByType( "vehicle" ) ) do local distance = getDistanceBetweenPoints3D( x, y, z, getElementPosition( v ) ) if distance <= ( prevDistance or distance + 1 ) then prevDistance = distance nearestVehicle = v end end return nearestVehicle or false end function doSomethingWithTheNearestVeh( player ) local vehicle = getNearestVehicle( player ) -- get the nearest vehicle to the player who used the command if vehicle then fixVehicle( vehicle ) -- fix the nearest vehicle. this is just an example, you can do here anything else end end addCommandHandler( "repaircar", doSomethingWithTheNearestVeh )
-
As I said, this function is only for client-side, to use it on server-side, i have to modify it a bit, i will do it later ( cuz im from my phone now ). And it won't repair your vehicle, it just gets the nearest vehicle to the local player. An example how to use it: fixVehicle( getNearestVeicle() ) I've just noticed that a word is missing from the name of the function, of course it will work with this name too, just doesn't look good
-
This client-sided function should get you the nearest vehicle to the local player. function getNearestVeicle() local x, y, z = getElementPosition( localPlayer ) local prevDistance local nearestVehicle for i, v in ipairs( getElementsByType( "vehicle" ) ) do local distance = getDistanceBetweenPoints3D( x, y, z, getElementPosition( v ) ) if distance <= ( prevDistance or distance + 1 ) then prevDistance = distance nearestVehicle = v end end return nearestVehicle or false end
-
This is because when the player hits the pickup, you give him the ammo again. You don't need those lines in the "onPickupHit" event: local weapid = getPickupWeapon ( source ) local weapammo = getPickupAmmo ( source ) giveWeapon ( player, weapid, weapammo, false )
-
You have to put the resources in the resources folder of your server. You can add your .lua and .map files to any resource by copying the file to the resurces's directory and addng it to the meta .xml. or you also can create a new resource for your files
-
Not useless, it's awesome. I like your idea and I always like to learn new things, so maybe I will use this once.
-
You don't pass the player element to the server. Use source in your event server-side or do this: triggerServerEvent("Grove",localPlayer,localPlayer)
-
it will not work, I tested it many times when I was a newbie scripter Though, i did not use it much, it worked for me.... but I'm not sure, I will test it too
-
It's good, if he defined Grove somewhere like this: Grove = createTeam("some team")
-
Oh, you were a bit faster Samer, but yours should work also .
-
There are some solutions for this: teams = { ["busteam"] = true; ["busteam2"] = true } function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if ( busVehs[getElementModel ( source )] ) and ( not teams[getTeamName( getPlayerTeam( thePlayer ) )] ) then removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Bus Drivers can drive this vehicle!", thePlayer) end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) Or this: function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle if ( busVehs[getElementModel ( source )] ) and ( getPlayerTeam( thePlayer ) ~= team )] ) then removePedFromVehicle( thePlayer )-- force the player out of the vehicle outputChatBox("Only Bus Drivers can drive this vehicle!", thePlayer) end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle )
-
Try this: function hill_Enter ( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then if Hit == 0 then triggerClientEvent ( thePlayer, "onEnterZonaPed", thePlayer ) Hit = 1 bindKey ( thePlayer, "enter", "down", function ( thePlayer ) unbindKey ( thePlayer, "enter", "down" ) enter = enter + 1 triggerClientEvent ( thePlayer, "onEnterCount", getRootElement(), enter ) setElementPosition (thePlayer, 0,0,5) bindKey ( thePlayer, "i", "down", function( thePlayer ) setElementPosition (thePlayer, -702.09185791016, 965.79370117188, 12.384881973267) end ) end ) end end end addEventHandler ( "onColShapeHit", hillArea, hill_Enter )
-
thePlayer is not defined in your script. And I also don't know what is this supposed to do.
-
Lol, what is this? But it seems to be something encrypted, so you can't just "translate" it.
-
[TUT] Setting up MTA server on Ubuntu Server 12.04.1 LTS
csiguusz replied to AGENT_STEELMEAT's topic in Linux-Server
Oh, i didn't read the tutorial just answered his question, but yes, you're right. -
[TUT] Setting up MTA server on Ubuntu Server 12.04.1 LTS
csiguusz replied to AGENT_STEELMEAT's topic in Linux-Server
To start the server with screen you can use this command: screen -S mta /something/server/mta-server And then press ctrl + A,D (hold ctrl while pressing both buttons) to leave the screen. To resume the screen: screen -r mta -
I searched a bit and found this: https://forum.multitheftauto.com/viewtopic.php?f=15&t=46370 I think you could have also found this
-
Your code is absolutely wrong. Something like this should work: addEventHandler("onPlayerDamage", getRootElement(), function(attacker) if ( attacker and attacker ~= source and getElementType ( attacker ) == "ped" ) then setTimer( function( player ) setElementHealth( player, getElementHealth( player ) - 1 ) end, 200, 20, source ) end end)
-
Ahh... aren't you in a good mood today? As I said I know it's not much, I just told sora that it's not so bad to re-define a pre-defined variable. And of course: every µs is important!
-
It's working for me. Did you add your client script file to your meta.xml?
-
You are welcome!
