SA-MP Forums Archive
Commands Bugged (/medic && /food) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Commands Bugged (/medic && /food) (/showthread.php?tid=225991)



Commands Bugged (/medic && /food) - Unknown123 - 14.02.2011

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;
    }
}



Re: Commands Bugged (/medic && /food) - Ideal-Host.co.uk - 14.02.2011

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


Re: Commands Bugged (/medic && /food) - Anteino - 14.02.2011

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.


Re: Commands Bugged (/medic && /food) - Unknown123 - 14.02.2011

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"


Re: Commands Bugged (/medic && /food) - Ideal-Host.co.uk - 14.02.2011

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


Re: Commands Bugged (/medic && /food) - Ash. - 14.02.2011

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.


Re: Commands Bugged (/medic && /food) - Unknown123 - 14.02.2011

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


Re: Commands Bugged (/medic && /food) - Antonio [G-RP] - 14.02.2011

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.


Re: Commands Bugged (/medic && /food) - Unknown123 - 14.02.2011

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..