Question for command
#1

Hello how can i make command for Medic /heal ID i use

pawn Код:
if(PlayerInfo[playerid][pMember] == TEAM_MEDIC)
   {
            if(PlayerInfo[playerid][pHealme] <= 0)
            {
Please help me
Reply
#2

I've used ZCMD.

pawn Код:
CMD:heal(playerid,params[])
{
    if(PlayerInfo[playerid][pMember] == TEAM_MEDIC)
    {
        if(PlayerInfo[playerid][pHealme] <= 0)
        {
            new Float:health,string[128],name[MAX_PLAYER_NAME];
            if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /heal [playerid]");
            GetPlayerName(playerid,name,sizeof(name));
            SetPlayerHealth(strval(params),100);
            format(string,sizeof(string),"You've been healed by Medic %s",name);
            SendClientMessage(strval(params),0xFF8000AA,string);
        }
    }
    return 1;
}
Reply
#3

4 Errors "

pawn Код:
(11787) : warning 219: local variable "string" shadows a variable at a preceding level
(11788) : error 017: undefined symbol "params"
(11788) : error 029: invalid expression, assumed zero
(11788) : error 017: undefined symbol "params"
(11788) : fatal error 107: too many error messages on one line

pawn Код:
if(isnull(params)) return SendClientMessage(playerid,-1,"Ползвай: /heal [playerid]");
I Use strcmp
Reply
#4

And command doesnt work command heal only me pls help
Reply
#5

I don't know the native command system much but with help of wikki I've created it for you.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[30];
    new idx;
    cmd = strtok(cmdtext, idx);
 
    if(strcmp(cmd, "/heal", true) == 0)
    {
        new tmp[30];
        tmp = strtok(cmdtext, idx);
 
        new pID = strval(tmp);
        if(IsPlayerConnected(pID))
        {
            new Float:health,string[128],name[MAX_PLAYER_NAME];
            GetPlayerName(playerid,name,sizeof(name));
            SetPlayerHealth(strval(params),100);
            format(string,sizeof(string),"You've been healed by Medic %s",name);
            SendClientMessage(strval(params),0xFF8000AA,string);
           
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)