SA-MP Forums Archive
/heal help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /heal help. (/showthread.php?tid=362375)



/heal help. - TaLhA XIV - 24.07.2012

PHP код:
#define TEAM_ME 1
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/heal"cmdtexttrue10) == 0)
    {
        
GetPlayerTeam(playerid,TEAM_ME);
        {
            new 
targetid;
            
SetPlayerHealth(playerid,100);
        }
        return 
1;
    }
    return 
0;

How can I apply this command on others.This restores my health!please help.


Re: /heal help. - Devilxz97 - 24.07.2012

use ZCMD , its works more faster's and easy


Re: /heal help. - [XS]Scarface - 24.07.2012

pawn Код:
#define TEAM_ME 1

public OnPlayerCommandText(playerid, cmdtext[])
{
#define TEAM_ME 1


    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        tmp  = strtok(cmdtext,idx);
        if(!strlen(tmp))
        {
        SendClientMessage(playerid, 0xFF0000AA, " USAGE: /heal [playerid]");
        return 1;
        }
        GetPlayerTeam(playerid,TEAM_ME);
        {
            new player1 = strval(tmp);
            SetPlayerHealth(player1,100);
            return 1;
        }
        return 1;
    }
    return 0;
}
this shall work..


Re: /heal help. - [MM]RoXoR[FS] - 24.07.2012

pawn Код:
CMD:heal(playerid,params[])
{
    new targetid,msg[100];
    if(sscanf(params,"u")) return SendClientMessage(playerid,-1,"Correct Usage /heal [playerid/name]");
    if(GetPlayerTeam(targetid) != TEAM_ME)
    {
        format(msg,sizeof(msg),"%d is not of your team",targetid);
        return SendClientMessage(playerid,-1,msg);
    }
    format(msg,sizeof(msg),"You have successfully healed %d ",targetid);
    SetPlayerHealth(targetid,100);
    return 1;
}
I would strongly suggest to move to sscanf and ZCMD/YCMD


Re: /heal help. - TaLhA XIV - 24.07.2012

thanks people