-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
If you want to make some kind of portal gamemode and need a campanion cube, let me know.. I made one long time ago for a portal gamemode which was never finished. http://y50p.deviantart.com/gallery/ -- check out my gallery, you may find some cool stuff ;p
-
its not that hard, all you have to do is this: local root = getRootElement() addEventHandler("onPlayerWasted", root, function () setTimer (spawnPlayer, 5000, 1, source,2314.75+math.random(-1,1), -6.43+math.random(-1,1), 26.74) end ) not that hard i guess ^^ Do you even read what he's asking for?
-
You didn't copy the entire code... You're missing a few lines.
-
You want to fade out when player dies and fade in when he spawns? If so, how do you expect the camera to fade out when player dies if you don't use fadeCamera in onPlayerWasted event at all? That's logical.
-
If race returns getPlayerRank with value of 1 every time, for every player, then it's fault of race resource not yours and it will always give all players coins as if they were 1st.
-
You can control projectile but only its start velocity and rotation. So, if you calculate correct velocity and rotation, you can get the rocket to hit the target if the line of sight (of rocket) is clear.
-
Because you use wrong control names. Forwards and backwards are for peds who are not in vehicles. For peds inside vehicle use "accelerate" and "brake_reverse".
-
You use getElementVelocity only once and that is at the start of the resource so how do you expect it to work? You should use on every frame (onClientRender). "Checks" are if statements to check if something is true or not. local unitStr = "Km/h" local speedMultiplier = 160 local g_Me = getLocalPlayer(); function getspeed() local velX, velY, velZ = getElementVelocity( getPedOccupiedVehicle( g_Me ) ) return math.sqrt( (velX * velX) + (velY * velY) + (velZ * velZ) ) * speedMultiplier end function toggleUnits( ) speedMultiplier = ( speedMultiplier < 160 ) and 160 or 100; unitStr = ( unitStr == "Km/h" ) and "mph" or "Km/h"; end bindKey( "/", toggleUnits ) function drawspeed() if isPedInVehicle( g_Me ) then -- this is the check you need, don't draw the speed if player is not in vehicle dxDrawText( tostring( math.floor( getspeed() ) ), 911.0, 654.0, 982.0, 685.0, tocolor(255,255,255,255), 1.0, "bankgothic", "right", "left", false, false, false) dxDrawText( unitStr, 989.0, 664.0, 1019.0, 680.0, tocolor(255,255,255,255), 1.0, "default", "top", "left", false, false, false) end end addEventHandler("onClientRender", getRootElement(), drawspeed)
-
Google is your friend. Autodesk.com
-
if ( isObjectInACLGroup( "user." .. myName, aclGetGroup( "Medic" ) ) ) then
-
I suppose you took this command from freeroam but because you have no idea what else you need, you ask here? Well, you code is wrong. Sometimes (I mean all the time) you have to think before you do something. Explain to me what is your code doing? Step by step, line by line and we'll see what you don't understand.
-
Inside the resource... Find scripts which have addCommandHandler's and add true.
-
You need to add command name to any ACL (eg. Admin) which you have in Admin group and disable it for other players: Add this to <acl name="Default"> to disable the command for everyone <right name="command.YOURCOMMAND" access="false" /> And this to <acl name="Admin"> to allow admins to use it <right name="command.YOURCOMMAND" access="true" />
-
You need to add users to the ACL which is allowed to use these commands and add the commands to the group which can use these commands. I know it may sound complicated but you need to learn more about ACL. I've had difficulties to understand it at the beginning too but you must learn them if you want to script. Also, for restricted parameter in addEventHandler use true.
-
Use bindKey to bind a key to some function which will change value of unit. Also, make another global variable which will be the text to show what units it is, something like this: function toggleUnits( ) unit = ( unit < 160 ) and 160 or 100; unitStr = ( unitStr == "Km/h" ) and "mph" or "Km/h"; end
-
Use tostring( getspeed() ) because tostring( getspeed ) will convert function to a string and return its address but you want to call the function and convert returned value to string.
-
addCommandHandler( "medic", function( plr, cmd, victim ) local myName = getPlayerName( plr ); if ( isObjectInACLGroup( "user." .. myName, aclGetGroup( "Medic" ) ) then local victimPlr = getPlayerFromName( victim ); if victimPlr then local victimName = getPlayerName( victimPlr ); local x,y,z = getElementPosition( plr ); local x2,y2,z2 = getElementPosition( victimPlr ); if getDistanceBetweenPoints3D( x,y,z, x2,y2,z2 ) <= 1 then if getElementHealth( victimPlr ) < 80 then setElementHealth( victimPlr, 80 ); outputChatBox( myName .. " has given medical attention to ".. victimName ); else outputChatBox( victimName .. " does not require medical attention!", plr ); end else outputChatBox( "You are not close enough to " .. victimName .. "!", plr ); end else outputChatBox( "No player found with '".. victimName .. "' name!", plr ); end end end ) I don't want any money. I gave it to you because I made it long time ago and needed to change only a few things and I don't charge for scripts. Everything I script is for public use.
-
Because that's how you use them in most OS'es. You don't press A and then Shift to "Select all" or you don't press S and then Shift to "Save", you hold Shift and then press S.
-
Ok. I didn't test the previous code and I found a few "bugs". Here is the code which I tested and works perfectly (server-side): local keysList = { "a", "b", "c", "d", "e", "f", "lshift" } -- etc., list of the keys you want to check local playerKeyState = { }; -- every player's key state -- bind the keys for every player online addEventHandler( "onResourceStart", getResourceRootElement(), function() for i, plr in ipairs( getElementsByType( "player" ) ) do bindPlayerKeysList( plr ); end end ) addEventHandler( "onPlayerJoin", getRootElement( ), function( ) bindPlayerKeysList( source ); end ) function bindPlayerKeysList( player ) for j, key in ipairs( keysList ) do bindKey( player, key, "both", changeKeyState ); end end function isKeyDown( player, key ) return ( playerKeyState[ player ] ) and playerKeyState[ player ][ key ] or false; end -- This is the same function that I showed you above but added triggerEvent function changeKeyState( player, key, keyState ) if not playerKeyState[ player ] then playerKeyState[ player ] = { }; -- remember to nil this table when player leaves the server!!! end playerKeyState[ player ][ key ] = ( keyState == "down" ) and true or false; triggerEvent( "onPlayerKeyStateChange", player, key, keyState ); end -- Then you can attach handlers to the event and detect key press addEvent( "onPlayerKeyStateChange" ); addEventHandler( "onPlayerKeyStateChange", getRootElement(), function( key, keyState ) -- 1st way: must hold LSHIFT and then press A if isKeyDown( source, "lshift" ) and ( key == "a" ) and ( keyState == "down" ) then outputChatBox( getPlayerName( source ) .. " just hit LSHIFT + A (order: LSHIFT, A)" ); end -- 2nd way: doesn't have to hold LSHIFT before pressing A if isKeyDown( source, "lshift" ) and isKeyDown( source, "a" ) then outputChatBox( getPlayerName( source ) .. " just hit LSHIFT + A (order: doesn't matter)" ); end end )