Jump to content

Medic! (10$)


Recommended Posts

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 :D, 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
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 by Guest
Link to comment
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

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

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

*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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...