Код:
CMD:deliverpt(playerid, params[])
{
if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 3))
{
if(IsPlayerInAnyVehicle(playerid))
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /deliverpt [playerid]");
new carid = GetPlayerVehicleID(playerid);
new caridex = GetPlayerVehicleID(giveplayerid);
if(IsAnAmbulance(carid) || IsATierraESCar(carid))
{
if(carid == caridex)
{
if(IsAtDeliverPatientPoint(playerid))
{
if(playerid == giveplayerid)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot deliver yourself to the hospital!");
return 1;
}
if(GetPVarInt(giveplayerid, "Injured") == 0)
{
return SendClientMessageEx(playerid, COLOR_GRAD2, "That player is not injured!");
}
if(playerTabbed[giveplayerid] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "That player is paused, you can't currently deliver him!");
return 1;
}
SetPlayerHealth(giveplayerid, 100);
if(STDPlayer[giveplayerid] > 0)
{
STDPlayer[giveplayerid] = 0;
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the hospital's help!");
}
GivePlayerCash(giveplayerid, -1000);
Tax += 1000;
GivePlayerCash(playerid,2500);
KillEMSQueue(giveplayerid);
SetPVarInt(giveplayerid, "MedicBill", 0);
SendClientMessageEx(giveplayerid, TEAM_CYAN_COLOR, "Doc: Your medical bill comes in at $1000. Have a nice day!");
format(string,sizeof(string),"You received $2500 for successfully delivering the patient!");
SendClientMessageEx(playerid, TEAM_CYAN_COLOR, string);
SetPlayerPos(giveplayerid, 1169.7588,-1351.5490,2423.0461);
Streamer_UpdateEx(giveplayerid, 1169.7588,-1351.5490,2423.0461);
SetPlayerInterior(giveplayerid, 1);
PlayerInfo[giveplayerid][pInt] = 1;
TogglePlayerControllable(giveplayerid, 0);
GameTextForPlayer(giveplayerid, "Objects loading...", 4000, 5);
SetPVarInt(giveplayerid, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", giveplayerid);
PlayerInfo[playerid][pPatientsDelivered]++;
format(string, sizeof(string), "EMS Driver %s has successfully delivered Patient %s to the hospital.",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
SendRadioMessage(4, TEAM_MED_COLOR, string);
new Float:X, Float:Y, Float:Z;
GetObjectPos(Carrier[0], X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 5.0,1142.4733,-1326.3633,13.6259) || IsPlayerInRangeOfPoint(playerid, 5.0, 1165.1564,-1368.8240,26.6502))
{
SetPlayerVirtualWorld(giveplayerid, 2);
PlayerInfo[giveplayerid][pVW] = 2;
}
else if(IsPlayerInRangeOfPoint(playerid, 5.0,2027.0599,-1410.6870,16.9922) || IsPlayerInRangeOfPoint(playerid, 5.0, 2024.5742,-1382.7844,48.3359))
{
SetPlayerVirtualWorld(giveplayerid, 1);
PlayerInfo[giveplayerid][pVW] = 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 5.0,1227.2339,306.4730,19.7028) || IsPlayerInRangeOfPoint(playerid, 5.0, 1233.3384,316.4022,24.7578))
{
SetPlayerVirtualWorld(giveplayerid, 5);
PlayerInfo[giveplayerid][pVW] = 5;
}
else if(IsPlayerInRangeOfPoint(playerid, 5.0,1567.3102,-2167.7603,13.9169) || IsPlayerInRangeOfPoint(playerid, 5.0, 1567.3102,-2167.7603,13.9169))
{
SetPlayerVirtualWorld(giveplayerid, 4);
PlayerInfo[giveplayerid][pVW] = 4;
}
else if(IsPlayerInRangeOfPoint(playerid, 5.0,-2695.5725,639.4147,14.4531) || IsPlayerInRangeOfPoint(playerid, 5.0, -2656.0339,615.2567,66.0938))
{
SetPlayerVirtualWorld(giveplayerid, 6);
PlayerInfo[giveplayerid][pVW] = 6;
}
else if(IsPlayerInRangeOfPoint(playerid, 250,X, Y, Z))
{
SetPlayerVirtualWorld(giveplayerid, 7);
PlayerInfo[giveplayerid][pVW] = 7;
}
else if(IsPlayerInRangeOfPoint(playerid, 5.0,-1528.814331, 2540.706054, 55.835937))
{
SetPlayerVirtualWorld(giveplayerid, 99);
PlayerInfo[giveplayerid][pVW] = 99;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not near a deliver point - look out near the hospitals.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Patient must be in your car in order to deliver him.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in an FDSA vehicle.");
}
}
}
return 1;
}