Medic Problem
#1

When someone is already accepted the patient, the other are allowed to accept it too, i need some help to fix this please.
PHP код:
CMD:getpt(playeridparams[])
{
    if(
PlayerInfo[playerid][pLeader] == || PlayerInfo[playerid][pFaction] == 3)
    {
        new 
string[128], giveplayerid;
        if(
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /getpt(patient) [playerid/partofname]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
giveplayerid == playerid)
            {
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"You can't accept your own Emergency Dispatch call!");
                return 
1;
            }
            if(
GetPVarInt(giveplayerid,"MedicCall") == 1)
            {
                new 
bool:available true;
                foreach(new 
Player)
                {
                    if(
EMSAccepted[i] == giveplayerid || SetPVarInt(playerid,"EMSAttempt"2))
                    {
                        
available true;
                        break;
                    }
                }
                if(!
available)
                    return 
SendClientMessage(playeridCOLOR_GREY"That player is already being attended by another medic.");
                    
                if(
PlayerInfo[giveplayerid][pJailed] > 0) return SendClientMessage(playeridCOLOR_GRAD2"You can't use this command on jailed players.");
                
format(stringsizeof(string), "EMS Driver %s has accepted the Emergency Dispatch call for (%d) %s.",GetPlayerNameEx(playerid),giveplayerid,GetPlayerNameEx(giveplayerid));
                
SendRadioMessage(3TEAM_MED_COLORstring);
                
format(stringsizeof(string), "* You have accepted EMS Call from %s, you will see the marker until you have reached it.",GetPlayerNameEx(giveplayerid));
                
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                
format(stringsizeof(string), "* EMS Driver %s has accepted your EMS Call; please wait at your current position.",GetPlayerNameEx(playerid));
                
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring);
                
GameTextForPlayer(playerid"~w~EMS Caller~n~~r~Go to the red marker."50001);
                
EMSCallTime[playerid] = 1;
                
EMSAccepted[playerid] = giveplayerid;
                
SetPVarInt(giveplayerid"EMSAttempt"1);
                
PlayerInfo[playerid][pCallsAccepted]++;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_WHITE"The player has not requested any EMS attention!");
            }
        }
    }
    return 
1;

Reply


Messages In This Thread
Medic Problem - by TitoRayne - 16.04.2018, 10:02
Re: Medic Problem - by ProScripter - 16.04.2018, 10:13
Re: Medic Problem - by TitoRayne - 16.04.2018, 10:21
Re: Medic Problem - by Zeus666 - 16.04.2018, 10:27
Re: Medic Problem - by TitoRayne - 16.04.2018, 10:28
Re: Medic Problem - by ProScripter - 16.04.2018, 10:28
Re: Medic Problem - by TitoRayne - 16.04.2018, 10:31

Forum Jump:


Users browsing this thread: 1 Guest(s)