Blackvein Posted July 15, 2010 Share Posted July 15, 2010 10$ US via Paypal to the first person to successfully make a 'medic' script that meets the following requirements: - Only people in a specific ACL group are medics.- A medic can type this command: "/heal [playername]" and the following action will take place: *If the medic is within 1 Z, X and Y coordinate of [playername], [playername]'s current health will be set to 80, if [playername]'s health was below 80 to begin with.*- When a medic types /heal [playername], the following text is ouput into the global chatbox:"[medicname] has given medical attention to [playername].-If the medic is not within 1 Z, X and Y coordinate of [playername], the following text is output into the medic's local chat:"You are not close enough to that player!"-If [playername]'s health is above 80, the following text is displayed into the medic's local chat:"That player does not require medical attention!"I think the hardest part would be checking to see if the medic is within 1 Z, Y and X coordinate of the player,but with a little effort, and heart , i think it can be done. Plus you get 10 bucks!Please put some thought into this if you are a good scripter. Thanks! Link to comment
dzek (varez) Posted July 15, 2010 Share Posted July 15, 2010 it will be better if i know if somebody else is preparing this already Link to comment
50p Posted July 15, 2010 Share Posted July 15, 2010 (edited) 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. Edited July 17, 2010 by Guest Link to comment
Dark Dragon Posted July 15, 2010 Share Posted July 15, 2010 - A medic can type this command: "/heal [playername]" and the following action will take place: come on, this is mta, you can make them able to click their patient or at least use a bind Link to comment
Headshot4Fun Posted July 15, 2010 Share Posted July 15, 2010 - A medic can type this command: "/heal [playername]" and the following action will take place: come on, this is mta, you can make them able to click their patient or at least use a bind Click? Are you talking about OnPlayerClick event? well, it can be a awesome idea, but some times i think commands are better.Nice work 50p Link to comment
Blackvein Posted July 15, 2010 Author Share Posted July 15, 2010 Thanks a lot 50p ur the best. EDIT: It doesn't appear as though there's any part of the script that mentions a ''/heal'' command. If I type /heal ingame, literally nothing happens. Did you script another way of healing other players? Link to comment
norby89 Posted July 15, 2010 Share Posted July 15, 2010 EDIT: It doesn't appear as though there's any part of the script that mentions a ''/heal'' command.If I type /heal ingame, literally nothing happens. Did you script another way of healing other players? First line, change "medic" to "heal". Link to comment
Blackvein Posted July 15, 2010 Author Share Posted July 15, 2010 hmm, I changed ''medic'' to ''heal''. Still, nothing happens when i type /heal [playername]. I noticed that console returns 2 errors when I load the medic script. [2010-07-15 18:01:25] SCRIPT ERROR: Medic/medicScript.lua:4: ')' expected near 'then' [2010-07-15 18:01:25] WARNING: Loading script failed: Medic/medicScript.lua:4: ')' expected near 'then' Heres the script just in case: addCommandHandler( "heal", function( plr, cmd, victim ) local myName = getPlayerName( plr ); if ( isObjectInACLGroup( "user." .. myName, getACLGroup( "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 ) Link to comment
50p Posted July 15, 2010 Share Posted July 15, 2010 if ( isObjectInACLGroup( "user." .. myName, aclGetGroup( "Medic" ) ) ) then Link to comment
Blackvein Posted July 16, 2010 Author Share Posted July 16, 2010 Arrrgh, it was working fine, but all of a sudden console is returning this error: [2010-07-16 10:43:29] ERROR: Medic/medicScript.lua:4: attempt to call global 'getACLGroup' (a nil value) addCommandHandler( "heal", function( plr, cmd, victim ) local myName = getPlayerName( plr ); if ( isObjectInACLGroup( "user." .. myName, getACLGroup( "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 ) Link to comment
eAi Posted July 16, 2010 Share Posted July 16, 2010 Notice how getACLGroup isn't in blue in your code above? That's because it doesn't exist. It's aclGetGroup. Link to comment
Blackvein Posted July 17, 2010 Author Share Posted July 17, 2010 *facepalm & sigh* now im getting THIS error: [2010-07-17 15:13:30] SCRIPT ERROR: Medic/medicScript.lua:20: 'end' expected (to close 'if' at line 6) near '<eof>' [2010-07-17 15:13:30] WARNING: Loading script failed: Medic/medicScript.lua:20: 'end' expected (to close 'if' at line 6) near '<eof>' addCommandHandler( "heal", 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 Link to comment
50p Posted July 17, 2010 Share Posted July 17, 2010 You didn't copy the entire code... You're missing a few lines. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now