Jump to content

Medic! (10$)


Recommended Posts

Posted

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!

Posted

it will be better

if i know if somebody else is preparing this already

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted (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 by Guest
Posted
  • - 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

cod4-09.png
Posted

Thanks a lot 50p ur the best. :D

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?

Posted
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".

:d::i::s::g::r::a::c::e:

norby89.png

Posted

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
)

Posted

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
)

Posted

Notice how getACLGroup isn't in blue in your code above? That's because it doesn't exist. It's aclGetGroup.

Posted

*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

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...