Commands Bugged (/medic && /food)
#1

They dont work...

pawn Код:
dcmd_medic(playerid, params[])
{
    #pragma unused params
    if(gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid, COLOR_ERROR, "You is an medic, You dont need to reques other medics, try /commands instead");
    else if(HasRequestedMedic[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "You have already requested an medic, please sit down and wait");
    else
    {
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(gTeam[i] == TEAM_MEDIC)
            {
                new playername[MAX_PLAYER_NAME], string[128];
                GetPlayerName(i, playername, sizeof(playername));
   
                format(string, sizeof(string), "%s(%d) has requested medic in %s", playername, playerid, GetPlayerZone(playerid));
                SendClientMessage(i, COLOR_GREEN, string);
                printf("%s", string);
               
                SendClientMessage(i, COLOR_GREEN, "You have requested an medic");
               
                HasRequestedMedic[playerid] = 1;
                return 1;
            }
        }
        return 1;
    }
}
pawn Код:
dcmd_food(playerid, params[])
{
    #pragma unused params
    if(gTeam[playerid] == TEAM_BISTRO) return SendClientMessage(playerid, COLOR_ERROR, "You is an bistro, You cant call for other bistros");
    else if(HasRequestedBistro[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "You have already requested an bistro, please sit down and wait");
    else
    {
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(gTeam[i] == TEAM_BISTRO)
            {
                new playername[MAX_PLAYER_NAME], string[128];
                GetPlayerName(i, playername, sizeof(playername));

                format(string, sizeof(string), "%s(%d) has requested food in %s", playername, playerid, GetPlayerZone(playerid));
                SendClientMessage(i, COLOR_GREEN, string);
                printf("%s", string);

                SendClientMessage(i, COLOR_GREEN, "You have requested an food");

                HasRequestedBistro[playerid] = 1;
                return 1;
            }
        }
        return 1;
    }
}
Reply
#2

Try removing the return 1; from if(gTeam[i] == TEAM_BISTRO),

and tell me if it work, or i will look into the problem abit more
Reply
#3

Dude, spelling mistakes:

You is an medic, You dont need to reques other medics, try /commands instead ==> You are a medic, you don't need to request other medics, try /commands instead.
You have already requested an medic, please sit down and wait ==> You have already requested a medic, please sit down and wait.
You have requested an food ==> You have requested some food.
Reply
#4

Quote:
Originally Posted by Anteino
Посмотреть сообщение
Dude, spelling mistakes:

You is an medic, You dont need to reques other medics, try /commands instead ==> You are a medic, you don't need to request other medics, try /commands instead.
You have already requested an medic, please sit down and wait ==> You have already requested a medic, please sit down and wait.
You have requested an food ==> You have requested some food.
Details, details, details, i dont care about details, I WANT THE CODE TO WORK!

EDIT:
@ Ideal-Host.co.uk, i guess i will get something like""dcmd_food" should return a value"
Reply
#5

You will not get an error by removing that

and what i think it happening is when its found the first if(gTeam[i] == TEAM_MEDIC)
its not looking again because of the return.

so if you just try it.


Thanks
Reply
#6

Quote:
Originally Posted by Ideal-Host.co.uk
Посмотреть сообщение
You will not get an error by removing that

and what i think it happening is when its found the first if(gTeam[i] == TEAM_MEDIC)
its not looking again because of the return.

so if you just try it.


Thanks
The return will only process if(gTeam[i] == TEAM_MEDIC) == true.

Otherwise, i cant see anything wrong, but it could just be because im tired - sorry.
Reply
#7

Suprice, i got this error:
pawn Код:
C:\Users\Unknown\Documents\MyServer\gamemodes\Unknown.pwn(2756) : warning 209: function "dcmd_food" should return a value
:P
Reply
#8

Hey buddy, hows about you tell us what exactly is WRONG with the command? Does it return any SendClientMessage's ? How about you put some print's in the code and figure out the problem.
Reply
#9

Quote:
Originally Posted by Antonio [G-RP]
Посмотреть сообщение
Hey buddy, hows about you tell us what exactly is WRONG with the command? Does it return any SendClientMessage's ? How about you put some print's in the code and figure out the problem.
Hey :P

The problem was that when i used the command, nothing happens (i even didn't get "SERVER: Unknown Command")..

Anyway, the proble is solved, It was some ugly NPC's who made the command bugged, BUT, Hmm, that maybe means the command is bugged for another ID?

because when you add for example 5 NPC's and the you connect, then your ID will be 6..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)