SA-MP Forums Archive
Tell player if no medics connected.. - 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: Tell player if no medics connected.. (/showthread.php?tid=79889)



Tell player if no medics connected.. - SiJ - 31.05.2009

Hey,
I have this command:
pawn Код:
dcmd_callmedics(playerid, params[])
{
    new location[256], name [MAX_PLAYER_NAME];
    if (sscanf(params, "s", location)) UsageMsg(playerid, "Usage: /callmedics <your location>");
    else{
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(gTeam[i] == TEAM_MEDICS)
            {
              if(MedicOnDuty[i] == 1)
                {
                  GetPlayerName(playerid,name,sizeof(name));
                    SendFMessage(i,COLOR_RED,"Player %s needs for medics.",name);
                    SendFMessage(i,COLOR_RED,"Location: %s.",location);
                    SystemMsg(playerid,"You have called for a medics. Do not move and wait.");
                }
            else ErrorMsg(playerid, "No Medics on duty right now."); // This line doesn't work
            }
        }
    }
    return 1;
}
How can I tell player if there are no medics on duty at the moment?

(This command works if there are medics on duty)


Re: Tell player if no medics connected.. - Daren_Jacobson - 31.05.2009

can i see your ErrorMsg function?


Re: Tell player if no medics connected.. - SiJ - 31.05.2009

Quote:
Originally Posted by Daren_Jacobson
can i see your ErrorMsg function?
Oh, here it is:
stock ErrorMsg(playerid,msg[]) {
if ((IsPlayerConnected(playerid))&&(strlen(msg)>0)) {
SendClientMessage(playerid,COLOR_ERROR,msg);
}
return 1;
}
P.S. Not by me..

EDIT:
Thanks Daren_Jacobson!


Re: Tell player if no medics connected.. - Daren_Jacobson - 31.05.2009

try this
pawn Код:
dcmd_callmedics(playerid, params[])
{
    new location[256], name[MAX_PLAYER_NAME], anymedics;
    if (sscanf(params, "s", location)) UsageMsg(playerid, "Usage: /callmedics <your location>");
    else
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(gTeam[i] == TEAM_MEDICS)
            {
                if(MedicOnDuty[i] == 1)
                {
                    GetPlayerName(playerid,name,sizeof(name));
                    SendFMessage(i,COLOR_RED,"Player %s has needs for a medic.",name);
                    SendFMessage(i,COLOR_RED,"Location: %s.",location);
                    anymedics = 1;
                   
                }
               
            }
        }
        if (anymedics == 1) SystemMsg(playerid,"You have called for a medic. Do not move and wait.");
        else ErrorMsg(playerid, "No Medics on duty right now.");
    }
    return 1;
}