Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: JackDawZ on November 11, 2012, 11:53:35 pm

Title: Healing in 5 secs :D
Post by: JackDawZ on November 11, 2012, 11:53:35 pm
Moderator note: This code does not work with players who have an ID other than 0.
See post: http://forum.vicecitymultiplayer.com/index.php?topic=5276.msg32006#msg32006

Hello guys, and i want to share with you by my little script "Healing in 5 secs" xD
It's very easy:

Command:
[pawn]}
   else if ( strcmp( cmd, "!heal", true ) == 0 )
   {
      new Float:Health; GetPlayerHealth( playerid, Health );
        if ( Health >= 100 ) SendClientMessage( playerid, COLOR_YELLOW, ">> Error: You are healthy." );
      else
      {
          TogglePlayerControllable(playerid,0);
         SetTimer("Healing",5000,0);
          GameTextForPlayer(playerid, "Healing");
      }
      return 1;
      }
   return 1;
}[/pawn]

Timer:
[pawn]}
public Healing(playerid)
{
TogglePlayerControllable(playerid, 1);
SetPlayerHealth( playerid, 100.0 );
SendClientMessage( playerid, COLOR_YELLOW, ">> You have been healed!" );
}[/pawn]

Have fun! ;)
Title: Re: Healing in 5 secs :D
Post by: stormeus on November 12, 2012, 12:23:24 am
I'd like to be the first to point out that
this won't work with player IDs > 0
Title: Re: Healing in 5 secs :D
Post by: [KB]ViceMania on December 16, 2012, 11:33:43 pm
So if you do not want to become???  :)

else if ( strcmp( cmd, "!heal", true ) == 0 )
   {
      new Float:Health; GetPlayerHealth( playerid, Health );
        if ( Health >= 100 ) SendClientMessage( playerid, COLOR_YELLOW, ">> Error: You are healthy." );
      else
      {
          TogglePlayerControllable(playerid,0);
          SetTimer("Healing",5000,0);
                    SetPlayerHealth( playerid, 100.0 );
          GameTextForPlayer(playerid, "Helaed.. ~w~pleace wait.");
      }
      return 1;
      }

public Healing(playerid)
{
TogglePlayerControllable(playerid, 1);
}
Title: Re: Healing in 5 secs :D
Post by: stormeus on December 21, 2012, 11:33:45 pm
Alright, I'm about done with this. Both of the above snippets DO NOT WORK PROPERLY. Only players with an ID of 0 will be healed, meaning IDs 1-49 will not be able to heal. Please learn Pawn syntax and semantics before even attempting this.

This thread is locked as the code is useless.