pawn Код:
CMD:medicduty(playerid)
{
new sendername[MAX_PLAYER_NAME];
sendername = PlayerNameEx(playerid);
if(IsAMedic(playerid))
{
if (PlayerToPoint(3, playerid,255.3,77.4,1003.6) || PlayerToPoint(3,playerid,-1616.1294,681.1594,7.1875) || PlayerToPoint(3,playerid,2285.80, -2044.13, -28.95) || PlayerToPoint(10,playerid,255.20, 189.71, 1008.17) || PlayerToPoint(10,playerid,228.40, 111.00, 1003.21))
{
new rtext[50];
new string[128];
if(OnMedicDuty[playerid] == 0)
{
SaveGuns(playerid);
ResetPlayerWeaponsEx(playerid);
if(PlayerInfo[playerid][pMember] == 3)
{
if(PlayerInfo[playerid][pRank] == 1) { rtext = "Hidden"; }
else if(PlayerInfo[playerid][pRank] == 2) { rtext = "Hidden"; }
else { rtext = "Hidden"; }
format(string, sizeof(string), "* %s %s goes on-duty.", rtext, sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GivePlayerWeaponEx(playerid, 42, GunClip[24]*500);
OnMedicDuty[playerid] = 1;
SaveGuns(playerid);
MedicWeapons[playerid] = 1;
return 1;
}
}
else if(OnMedicDuty[playerid] == 1)
{
format(string, sizeof(string), "* %s goes off duty and puts %s equipment back.", sendername, HisHer(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerWeapons(playerid);
MedicWeapons[playerid] = 0;
OnMedicDuty[playerid] = 0;
new originalskin = PlayerInfo[playerid][pModel];
SetPlayerSkin(playerid, originalskin);
SetPlayerArmour(playerid, 0.0);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in the locker room!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not part of the SD-EMS!");
}
return 1;
}
It's exactly the same as the /duty command for cops, except (IsACop is replaced with (IsAMedic and (OnDuty is replaced with (OnMedicDuty.
And for the uniform command...
pawn Код:
CMD:medicuniform(playerid, params[])
{
if(!IsAMedic(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not a part of SD-EMS!!");
return 1;
}
else if(!OnMedicDuty[playerid])
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not on duty!");
return 1;
}
else if(!IsPlayerInRangeOfPoint(playerid, 3.0, 255.3,77.4,1003.6) && !IsPlayerInRangeOfPoint(playerid, 3.0, -1616.1294,681.1594,7.1875) && !IsPlayerInRangeOfPoint(playerid, 10.0, 228.40, 111.00, 1003.21))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in the locker room!");
return 1;
}
new skin;
new string[128];
if(PlayerInfo[playerid][pMember] == 3)
{
if(!sscanf(params, "i", skin))
{
switch(skin)
{
case 0:
{
format(string,sizeof(string), "* %s puts %s medical uniform back in the locker.", PlayerNameEx(playerid), HisHer(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
case 1:
{
SetPlayerSkin(playerid, 280);
format(string, sizeof(string), "* %s gets on a medical uniform.", PlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
case 2:
{
SetPlayerSkin(playerid, 280);
format(string, sizeof(string), "* %s gets on a medical uniform.", PlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
case 3:
{
SetPlayerSkin(playerid, 280);
format(string, sizeof(string), "* %s gets on a medical uniform.", PlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
default:
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Invalid uniform!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Uniform [Uniform ID]");
SendClientMessage(playerid, COLOR_YELLOW, "_________Uniform List_________");
SendClientMessage(playerid, COLOR_WHITE, "0: No Uniform");
SendClientMessage(playerid, COLOR_WHITE, "1: Medic Uniform 1");
SendClientMessage(playerid, COLOR_WHITE, "2: Medic Uniform 2");
SendClientMessage(playerid, COLOR_WHITE, "3: Medic Uniform 3");
return 1;
}
}
return 1;
}
There's nothing wrong with the scripting, as these commands work as cop commands.