/heal command - Will it work?
#1

Hi there,

I have made a /heal command for medics:

Код:
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
Reply
#2

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
Reply
#3

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?
Reply
#4

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

pawn Код:
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;
    }
Reply
#5

I get a load of errors, about 20-30 errors :/ Any other possible way of doing /heal?
Reply
#6

You got 26 errors because he missed a 1bracket
Reply
#7

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.
Reply
#8

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.
Reply
#9

There isn't anything wrong with that script, but I don't know how SA-MP takes to non ascii characters.
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)