[SOLVED] /paramedics Command
#1

Hello guys, how you doin'?

I'm here to ask you to analyse this command, 'cuz, no kidding, I've spent like 5/6 hours (not consecutive hours) trying to fix this command.

Take a look:

pawn Код:
if(strcmp(cmdtext,"/paramedicos", true) == 0)  {
      if(gTeam[playerid] != TIME_PARAMEDICO) {
            SendClientMessage(playerid, COR_ROXO, "> You've called the paramedics. Wait here.");
            new cel = SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
            SetTimerEx("LimparCel", 5000, false, "LimparCel", cel);
            pediucura[playerid] = 1;
            new current_zone;
            current_zone = player_zone[playerid];
            for(new i; i<MAX_PLAYERS; i++){
            if(IsPlayerConnected(playerid))
                if(gTeam[playerid] == TIME_PARAMEDICO)  {
                    new solicitador[MAX_PLAYER_NAME];
                    new str[128];
                    GetPlayerName(playerid, solicitador, sizeof(solicitador));
                    SendClientMessage(playerid, COR_VERMELHO, "teste");
                    format(str, 128, "[QG]> %s ask for paramedics. Spot: %s", solicitador, zones[current_zone][zone_name]);
                    SendClientMessage(playerid, COR_PARAMEDICO, str);
                    return 1;
            }
            }
        } else if(gTeam[playerid] == TIME_PARAMEDICO)  {
          SendClientMessage(playerid, COR_VERMELHO, "> Paramedics cannot use this command!");
          return 1;
        }
        return 1;
    }
First I'll explain how it was supposed to work:

I'm not a Paramedic and call the Paramedics. If the player is a Paramedic and is Online, he will receive a message that I need one. There's a ZONE system that will tell automaticaly my Neighborhood.

Here's the issue:

As in a different team, I call the paramedics and I got the message I was supposed to see (You've called the paramedics. Wait here"). But, as I don't have anyone to test with me, I put the command for a BOT to do this for me. I did this in the BOT:

pawn Код:
SendCommand("/teste");
SendCommand)/"paramedicos");
The /teste will show me a message, so I know the bot did the command properly, and the /paramedicos will (or at least was supposed to) show me the message "[QG]> NAME ask for paramedics. Spot: SPOT"

So, I get in the team Paramedic, and I receive the message that the BOT send to me, that's the "/teste" for, but I was supposed to see the "/paramedicos" answer, but I got nothing.

Someone understand? If not, please reply and I'll explain better.

No, the issue is not in the ZONES, 'cauze I've a /where command and it works properly.

Wait for answers and solutions.

Regards,

CaZeaJe'
Reply
#2

Can you show the definition for gTeam.
Is each player limited to just the one team?
If not then you need to use & and not ==.
Reply
#3

Quote:
Originally Posted by mansonh
Can you show the definition for gTeam.
Is each player limited to just the one team?
If not then you need to use & and not ==.
Sure I can. Here it is:

pawn Код:
#define TIME_PARAMEDICO 10

new gTeam[MAX_PLAYERS];

SetPlayerTeamFromClass(playerid, classid) {

     if(classid == 0) {

            gTeam[playerid] = TIME_PARAMEDICO;

        }
Here's what you want. If it's not, please tell me.

And yes, this command is just for players that are not in the TIME_PARAMEDICO, or Paramedic Team.

EDIT --

I made it work... but for teams that are not Paramedic o.o

I did this now:

pawn Код:
if(strcmp(cmdtext,"/paramedicos", true) == 0)  {
      if(gTeam[playerid] != TIME_PARAMEDICO) {
            SendClientMessage(playerid, COR_ROXO, "> Vocк chamou os Paramйdicos. Aguarde neste local.");
            new cel = SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
            SetTimerEx("LimparCel", 5000, false, "LimparCel", cel);
            pediucura[playerid] = 1;
            new current_zone;
            current_zone = player_zone[playerid];
            for(new i; i<MAX_PLAYERS; i++){
            if(IsPlayerConnected(playerid && gTeam[playerid] == TIME_PARAMEDICO))  {
                new solicitador[MAX_PLAYER_NAME];
                new str[128];
                GetPlayerName(playerid, solicitador, sizeof(solicitador));
                SendClientMessage(playerid, COR_VERMELHO, "teste");
                format(str, 128, "[QG]> %s solicita paramйdicos. Local: %s", solicitador, zones[current_zone][zone_name]);
                SendClientMessage(playerid, COR_PARAMEDICO, str);
                return 1;
            }
            }
        } else if(gTeam[playerid] == TIME_PARAMEDICO)  {
          SendClientMessage(playerid, COR_VERMELHO, "> Paramйdicos nгo podem usar este comando!");
          return 1;
        }
    }
Any ideas?
Reply
#4

SOLVED BY A FRIEND OF MINE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)