Vice City: Multiplayer

Server Development => Scripting and Server Management => Script and Content Requests => Topic started by: W3aPoN^ on Jul 23, 2016, 01:25 PM

Title: New Heal Settings
Post by: W3aPoN^ on Jul 23, 2016, 01:25 PM
Hello Guys I Want To Create New Settings For heal If A Player is on ROAD and typing /heal Then He Cannot heal Himself An A message will go to the player you must be at HOSPITAL Or Drug Store To Heal Yourself And When He Goes To Hospital Or Drug Store Then He Can Heal HELP ME THANKS IN ADVANCE
Title: Re: New Heal Settings
Post by: Kewun on Jul 23, 2016, 01:30 PM
use Distance thing

function Distance(x1, y1, x2, y2)
{
local dist = sqrt(((x2 - x1)*(x2 - x1)) + ((y2 - y1)*(y2 - y1)));
return dist;
}

after , the cmd
if(cmd=="heal")
{
local hospital = Distance(player.Pos.x, player.Pos.y, Hospital.x, Hospital.y)
if (hospital < 5 )
player.Health = 100
MessagePlayer("You healed",player)
}

and god damnit stop using big font size, you dont need to scream. if you scream like that, no one is gonna help u.
Title: Re: New Heal Settings
Post by: vito on Jul 23, 2016, 01:37 PM
or use Pos1.Distance(Pos2) to caluculate distance between 2 Vectors in 3d.
Title: Re: New Heal Settings
Post by: W3aPoN^ on Jul 23, 2016, 01:43 PM
Bros Where To Add Distance Function? THANKS Waiting...
Title: Re: New Heal Settings
Post by: Kewun on Jul 23, 2016, 01:48 PM
in Distance.nut
same as the command, but u need to add it to onPlayerCommand(player,cmd,text) fuction
Title: Re: New Heal Settings
Post by: W3aPoN^ on Jul 23, 2016, 01:53 PM
Which Server Are you Using 0.4 OR 0.3?
Title: Re: New Heal Settings
Post by: Kewun on Jul 23, 2016, 01:56 PM
0.4
Title: Re: New Heal Settings
Post by: W3aPoN^ on Jul 23, 2016, 01:58 PM
Can You Please Give Me A Full Video Tutorial About That PLEASE?
Title: Re: New Heal Settings
Post by: Kewun on Jul 23, 2016, 01:59 PM
laziness
Title: Re: New Heal Settings
Post by: Finch Real on Jul 23, 2016, 04:48 PM
@razacharan Add Distance function in your main.nut after function onscriptload
And add command to function onPlayerCommand
Title: Re: New Heal Settings
Post by: Xmair on Jul 23, 2016, 05:20 PM
DistanceFromPoint is better.
Title: Re: New Heal Settings
Post by: DizzasTeR on Jul 24, 2016, 08:19 AM
Quote from: Xmair on Jul 23, 2016, 05:20 PMDistanceFromPoint is better.

Vector.Distance is alot better.