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