SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 29/05/2009, 09:58 AM   #1
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default /heal command - Will it work?

Hi there,

I have made a /heal command for medics:

Code:
if (strcmp("/heal", cmdtext, true, 10) == 0)
	{
    SetPlayerHealth(playerid, 100.0);
    SendClientMessage(playerid, COLOR_YELLOW,"*** Medyk cię uzdrowił! / A Medic Has Healed You!");
		return 1;
	}
But I'm not sure weather it will heal other people...
Hope you can help

Thank You And Regards
Puzi
Puzi is offline  
Old 29/05/2009, 10:00 AM   #2
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 0
Default Re: /heal command - Will it work?

It will heal only the person who says /heal
It will heal, But only the person who says the command will get healed, No-one else
JoeDaDude is offline  
Old 29/05/2009, 10:03 AM   #3
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default Re: /heal command - Will it work?

Quote:
Originally Posted by JoeDaDude
It will heal only the person who says /heal
It will heal, But only the person who says the command will get healed, No-one else
Oh, thanks for answer. Do you know how to do it so it will heal a player after his ID?
Puzi is offline  
Old 29/05/2009, 10:05 AM   #4
JoeDaDude
Gangsta
 
Join Date: Apr 2008
Posts: 673
Reputation: 0
Default Re: /heal command - Will it work?

Ok this is a sethealth command from my admin system,
But its not that hard to modify into a /heal

pawn Code:
if(strcmp(cmd, "/heal", true) == 0)
{
      tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, ORANGE, "USAGE: /sethp [playerid/name] [health]");
            return 1;
        }
        giveplayerid = ReturnUser(tmp);
        tmp = strtok(cmdtext, idx);
        new hp = strval(tmp);
        if (giveplayerid != INVALID_PLAYER_ID)
        {
            if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /sethp [playerid/name] [health]");
            SetPlayerHealth(giveplayerid,hp);
            Drugs[giveplayerid] = 0;
            GetPlayerName(playerid, sendername, sizeof(sendername));
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        format(string,sizeof(string),"|- Administrator %s has changed %s's HP. [HP: %d] -|",sendername,giveplayer,hp);
        SendClientMessageToAdmins(COLOR_RED,string,1);
        }
        else
        {
          SendClientMessage(playerid, RED, "Player is not active.");
        }
    }
    return 1;
    }
JoeDaDude is offline  
Old 29/05/2009, 10:57 AM   #5
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default Re: /heal command - Will it work?

I get a load of errors, about 20-30 errors :/ Any other possible way of doing /heal?
Puzi is offline  
Old 29/05/2009, 10:58 AM   #6
Gamer007
Huge Clucker
 
Join Date: Jun 2008
Posts: 209
Reputation: 0
Default Re: /heal command - Will it work?

You got 26 errors because he missed a 1bracket
Gamer007 is offline  
Old 29/05/2009, 11:25 AM   #7
miokie
High-roller
 
miokie's Avatar
 
Join Date: Jan 2007
Location: Bedfordshire, England
Posts: 1,148
Reputation: 13
Default Re: /heal command - Will it work?

Quote:
Originally Posted by Puzi
I get a load of errors, about 20-30 errors :/ Any other possible way of doing /heal?
Wiki.sa-mp.com

Fast Commands

It teaches you how to write a heal command there.
__________________
miokie is offline  
Old 29/05/2009, 11:32 AM   #8
Puzi
Huge Clucker
 
Join Date: Mar 2009
Posts: 325
Reputation: 0
Default Re: /heal command - Will it work?

Quote:
Originally Posted by Miokie*
Quote:
Originally Posted by Puzi
I get a load of errors, about 20-30 errors :/ Any other possible way of doing /heal?
Wiki.sa-mp.com

Fast Commands

It teaches you how to write a heal command there.
It doesn't help mate. No errors but i get Pawn Compiler Library Windows Error before its compiled. When I had that before, my server kept crashing due to it.
Puzi is offline  
Old 29/05/2009, 11:58 AM   #9
Weirdosport
High-roller
 
Join Date: Jul 2008
Posts: 1,294
Reputation: 0
Default Re: /heal command - Will it work?

There isn't anything wrong with that script, but I don't know how SA-MP takes to non ascii characters.
Weirdosport is offline  
Old 19/11/2009, 08:29 PM   #10
zezam321
Little Clucker
 
Join Date: Aug 2008
Posts: 11
Reputation: 0
Default Re: /heal command - Will it work?

Quote:
Originally Posted by Puzi
I get a load of errors, about 20-30 errors :/ Any other possible way of doing /heal?
public OnPlayerCommandText(playerid, cmdtext[])
{
new
index,
cmd[20];
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/heal", true) == 0)
{
new
tmp[20],
id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
SetPlayerHealth(id, 100.0);
SendClientMessage(id, 0x00FF00AA, "You have been healed");
SendClientMessage(playerid, 0x00FF00AA, "Player healed");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[ERROR:]Not A Valid PlayerID");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[Usage:] /heal [playerid]");
}
return 1;
}
return 0;
}
zezam321 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help]Heal command Giotis11 Help Archive 4 07/07/2010 12:27 AM
help whit /heal command DarkPower Help Archive 6 11/04/2010 08:49 PM
[HELP] /heal command? DeltaAirlines12 Help Archive 4 27/12/2009 10:38 PM


All times are GMT. The time now is 07:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.