Three times command
#1

how to make a variable to used three times commands
mean /healme
Reply
#2

Example..

pawn Код:
new HealMax[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/heal", cmdtext, true, 5) == 0)
    {
        if(HealMax[playerid] != 3) // he don't use this command 3 time
        {
            // set player health to 100
            HealMax[playerid]++; // + 1
        }
        else // he use this command 3 times
        {
            SendClientMessageToAll(color, "you can use this command only 3 time per life");
        }
        return 1;
    }
    return 0;
}// matnix
Reply
#3

in zcmd please
Reply
#4

Try this:

pawn Код:
new HealMax[MAX_PLAYERS];//set it to HealMax[playerid]=0; when they disconnect
CMD:healme(playerid,params[])
{
    if(HealMax[playerid] != 3)
    {
        SetPlayerHealth(playerid,100);
        HealMax[playerid]++;
    }
    else return SendClientMessage(playerid,-1,"You have met the max limit of 3 heals");
    return 1;
}
Reply
#5

EDIT: Too late.. ^
Reply
#6

pawn Код:
D:\SERVER\filterscripts\script.pwn(132) : error 017: undefined symbol "HealMax"
D:\SERVER\filterscripts\script.pwn(132) : warning 215: expression has no effect
D:\SERVER\filterscripts\script.pwn(132) : error 001: expected token: ";", but found "]"
D:\SERVER\filterscripts\script.pwn(132) : error 029: invalid expression, assumed zero
D:\SERVER\filterscripts\script.pwn(132) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

new HealMax[MAX_PLAYERS];
Add this before the command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)