19.03.2014, 10:00
Hello guys. So I am currently working on to get players able to do /accept death when EMS is off duty and when EMS is on duty /accept death wont work.
So this is my current code.
But when EMS is on duty and a player types /accept death it says "You cant accept death when EMS is online" but when EMS is off duty and a player types /accept death nothing happens. Nothing pops up in the chat and just nothing happens. So my question is, what should I change to make the player able to do /accept death when EMS is off duty? Thanks for helping me out.
So this is my current code.
pawn Код:
stock EMSOnline()
{
new dutycount = 0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pDuty] == 1)
{
dutycount++;
}
}
}
if(dutycount > 0)
{
return 1;
}
return 0;
}
pawn Код:
if(strcmp(params,"death",true) == 0) {
if(EMSOnline())
return SendClientMessageEx(playerid, COLOR_RED, "You cant accept death when EMS is available");
}
else
{
if(GetPVarInt(playerid, "Injured") == 1) {
SendClientMessageEx(playerid, COLOR_WHITE, "You gave up hope and fell unconscious, you were immediately sent to the hospital.");
KillEMSQueue(playerid);
ResetPlayerWeaponsEx(playerid);
SpawnPlayer(playerid);
format(string, sizeof(string), "(( %s Has just accepted death, if this was done to AVOID, F8 and make a Complaint ))", GetPlayerNameEx(playerid));
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
format(string, sizeof(string), "AdmWarning: %s has just Accepted Death",GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED, string, 1);
}
else { SendClientMessageEx(playerid, COLOR_GREY, " You are not injured, you can't do this right now !"); }
}