/heal help.
#1

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

use ZCMD , its works more faster's and easy
Reply
#3

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

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

thanks people
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)