Help me please!!!
#1

I managed to reduce the numebr of errors in /heal command but still need help ,please take a look:

pawn Код:
if (strcmp("/heal", cmdtext, true, 5) == 0)
    {
                new gTeam1[MAX_PLAYERS];
                if(gTeam1[playerid] == TEAM_MEDICS)
                {
                   if(IsPlayerConnected(playerid))
                   {
                       new tmp[128];
                       tmp = strtok(cmdtext);
                       if(!strlen(tmp))
                       {
                          SendClientMessage(playerid,RED,"USAGE: /heal [playerid]");
                          return 1;
                       }
                       new player1;
                       player1 = ReturnUser(tmp);
                       tmp = strtok(cmdtext);
                       if(IsPlayerConnected(player1))
                       {
                          if(player1 != INVALID_PLAYER_ID)
                          {
                             SetPlayerHealth(player1,100);
                             GivePlayerMoney(playerid,300);
                             GivePlayerMoney(playerid,-300);
                             GetPlayerName(player1,pn1,sizeof(pn1));
                             GetPlayerName(playerid,medicname,sizeof(medicname));
                             new string[128];
                             format(string,sizeof(string),"%s has been healed by medic %s.",pn1,medicname);
                             SendClientMessageToAll(GREEN,string);
                         }
                      }
                  }
              }

    }

    return 0;
}
Errors:

Код:
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(525) : warning 202: number of arguments does not match definition
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(525) : error 047: array sizes do not match, or destination array is too small
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(533) : warning 202: number of arguments does not match definition
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(533) : error 047: array sizes do not match, or destination array is too small
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(541) : error 017: undefined symbol "pn1"
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(541) : error 017: undefined symbol "pn1"
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(541) : error 029: invalid expression, assumed zero
D:\Jocuri\GTA\GTA San Andreas\SAMP\samp03csvr_win32\gamemodes\sfrpcrdm.pwn(541) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
HELP ME FAST!!!
Reply
#2

"new gTeam1[MAX_PLAYERS];" has to be a global variable, i think.
Reply
#3

no if i leave it gTeam it says array must be idnexed and if Im indexing it it says array shadows at a preceding level so LEAVE that alone and look inside the command not at edges
Reply
#4

NOBODY yet(posted 1 day or 2 agos anyway still ened help)
Reply
#5

pawn Код:
if (strcmp("/heal", cmdtext, true, 5) == 0)
{
    new gTeam1[MAX_PLAYERS];
    if(gTeam1[playerid] == TEAM_MEDICS)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,RED,"USAGE: /heal [playerid]");
            return 1;
        }
        new player1;
        player1 = ReturnUser(tmp);
        if(IsPlayerConnected(player1))
        {
            SetPlayerHealth(player1,100);
            GivePlayerMoney(playerid,300);
            GivePlayerMoney(playerid,-300);
            new pn1[24], medicname[24];
            GetPlayerName(player1,pn1,sizeof(pn1));
            GetPlayerName(playerid,medicname,sizeof(medicname));
            new string[128];
            format(string,sizeof(string),"%s has been healed by medic %s.",pn1,medicname);
            SendClientMessageToAll(GREEN,string);
        }
    }
    return 1;
}
Reply
#6

pawn Код:
new gTeam1[MAX_PLAYERS]; // this needs to be global
...
if (strcmp("/heal", cmdtext, true, 5) == 0)
{
    if(gTeam1[playerid] == TEAM_MEDICS)
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,RED,"USAGE: /heal [playerid]");
            return 1;
        }
        new player1;
        player1 = ReturnUser(tmp);
        if(IsPlayerConnected(player1))
        {
            SetPlayerHealth(player1,100);
            GivePlayerMoney(playerid,300);
            GivePlayerMoney(playerid,-300);
            new pn1[24], medicname[24];
            GetPlayerName(player1,pn1,sizeof(pn1));
            GetPlayerName(playerid,medicname,sizeof(medicname));
            new string[128];
            format(string,sizeof(string),"%s has been healed by medic %s.",pn1,medicname);
            SendClientMessageToAll(GREEN,string);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)