Medic CMDs to law enforcement faction
#1

I want to let my law enforcement faction to have the medic cmds.
Is this correct?



Код:
CMD:getpt(playerid, params[])
{
	if(IsAMedic(playerid))
	//if(PlayerInfo[playerid][pMember] == 11 && PlayerInfo[playerid][pDivision] == 5)
	{
		new string[128], giveplayerid;
		if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /getpt(patient) [player]");

		if(IsPlayerConnected(giveplayerid))
		{
		    if (giveplayerid == playerid)
		    {
		        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "You cannot accept your own Emergency Dispatch call!");
				return 1;
		    }
			if(GetPVarInt(giveplayerid,"MedicCall") == 1)
			{
				if(PlayerInfo[giveplayerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command on jailed players.");
				if(GetPVarInt(giveplayerid, "MASK_USED")) {
					format(string, sizeof(string), "EMS Driver %s has accepted the Emergency Dispatch call for (%d) [Unknown].",GetPlayerNameEx(playerid),giveplayerid);
				} else {
					format(string, sizeof(string), "EMS Driver %s has accepted the Emergency Dispatch call for (%d) %s.",GetPlayerNameEx(playerid),giveplayerid,GetPlayerNameEx(giveplayerid));
				}
				SendGroupMessage(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));
				SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
				format(string, sizeof(string), "* EMS Driver %s has accepted your EMS Call; please wait at your current position.",GetPlayerNameEx(playerid));
				SendClientMessageEx(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
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "The person has not requested any EMS attention!");
			}
		}
	}
	return 1;
}
The //if(PlayerInfo[playerid][pMember] == 11 && PlayerInfo[playerid][pDivision] == 5) is the line I think is correct in order to give my law enforcement faction access to medic cmd.
Reply
#2

&& means and, || means or
so you want to tell the compiler:
if player pMember rank equals to 11 or player's pDivision equals to 5 so it will be like:
PHP код:
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pDivision] == 5
Reply
#3

use OR ||. check if they are a cop or medic.
Reply
#4

Quote:
Originally Posted by jlalt
Посмотреть сообщение
&& means and, || means or
so you want to tell the compiler:
if player pMember rank equals to 11 or player's pDivision equals to 5 so it will be like:
PHP код:
if(PlayerInfo[playerid][pMember] == 11 || PlayerInfo[playerid][pDivision] == 5
But I want it to be group(pMember) 11, division 5. Not, either in a group 11 or division 5.
Am I correct?
Reply
#5

Just to clear something out, in this script, pMember is defined as group ID in game, not rank.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)