SA-MP Forums Archive
A little help with calling medics? - 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: A little help with calling medics? (/showthread.php?tid=78649)



A little help with calling medics? - SiJ - 22.05.2009

Quote:
Originally Posted by Justas [SiJ
]
How can I check if there are no connected players in gTeam[i] == TEAM_MEDICS?
pawn Код:
dcmd_callmedics(playerid, params[])
{
    new place[256];
    new name [MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if (sscanf(params, "s", place)) UsageMsg(playerid, "Usage: /callmedics <your location>");
    else
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(gTeam[i] == TEAM_MEDICS)
        {
            SendFMessage(i,COLOR_SYSTEM,"Player %s needs for medics.",name);
            SendFMessage(i,COLOR_SYSTEM,"Location %s.",place);
            SystemMsg(playerid,"You have called for a medics. Do not move and wait for them.");
        }
    }
    return 1;
}
if I would do
pawn Код:
if(gTeam[i] == TEAM_MEDICS)
        {
            SendFMessage(i,COLOR_SYSTEM,"Player %s needs for medics.",name);
            SendFMessage(i,COLOR_SYSTEM,"Location %s.",place);
            SystemMsg(playerid,"You have called for a medics. Do not move and wait for them.");
        }
        else
        {
        //Send message to player that no medics are connected
        }
It would send message to player if there are at least one player who are NOT in TEAM_MEDICS.. Am I right?



Re: What does this line means? - HB - 22.05.2009

That line is creating a loop for the MAX_PLAYERS, which mostly is 200.


Re: What does this line means? - Think - 22.05.2009

so you can reset variables or something. its most often used at a mission with variables for each player.


Re: What does this line means? - SiJ - 22.05.2009

Ok, thanks for answers. I think I understood it now.


Re: What does this line means? - SiJ - 22.05.2009

How can I check if there are no connected players in gTeam[i] == TEAM_MEDICS?
pawn Код:
dcmd_callmedics(playerid, params[])
{
    new place[256];
    new name [MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if (sscanf(params, "s", place)) UsageMsg(playerid, "Usage: /callmedics <your location>");
    else
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(gTeam[i] == TEAM_MEDICS)
        {
            SendFMessage(i,COLOR_SYSTEM,"Player %s needs for medics.",name);
            SendFMessage(i,COLOR_SYSTEM,"Location %s.",place);
            SystemMsg(playerid,"You have called for a medics. Do not move and wait for them.");
        }
    }
    return 1;
}
if I would do
pawn Код:
if(gTeam[i] == TEAM_MEDICS)
        {
            SendFMessage(i,COLOR_SYSTEM,"Player %s needs for medics.",name);
            SendFMessage(i,COLOR_SYSTEM,"Location %s.",place);
            SystemMsg(playerid,"You have called for a medics. Do not move and wait for them.");
        }
        else
        {
        //Send message to player that no medics are connected
        }
It would send message to player if there are at least one player who are NOT in TEAM_MEDICS.. Am I right?