pawn Код:
#include <a_samp>
#include <a_players>
#define CYAN 0x00D2E1FF
#define WHITE 0xFFFFFFAA
#define PURPLE 0xC2A2DAAA
#define AUTODEATH_SECONDS 200
#define SCM SendClientMessage
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new Float:DeathPosX [MAX_PLAYERS];
new Float:DeathPosY [MAX_PLAYERS];
new Float:DeathPosZ [MAX_PLAYERS];
new IsDead [MAX_PLAYERS];
new SecsToGo [MAX_PLAYERS];
forward AutoDeath(playerid);
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public OnPlayerSpawn(playerid)
{
if (IsDead[playerid] == 1)
{
SetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+5);
SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid);
SCM(playerid,CYAN,"------------------ Health Advise -----------------");
SCM(playerid,WHITE,"You are wounded badly.");
SCM(playerid,WHITE,"Do /service EMS For calling medics.");
SCM(playerid,WHITE,"You can type /acceptdeath, if no medics are available.");
SCM(playerid,CYAN,"--------------------------------------------------------");
return 1;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:pX, Float:pY, Float:pZ;
GetPlayerPos(playerid, pX, pY, pZ);
DeathPosX[playerid] = pX;
DeathPosY[playerid] = pY;
DeathPosZ[playerid] = pZ;
IsDead[playerid] = 1;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(acceptdeath, 11, cmdtext);
#pragma tabsize 0
if(strcmp("/serviceems", cmdtext, true, 10) == 0)
{
if(Medics < 1)
{
SendClientMessage(playerid, COLOR_GREY, " There are no Medics On Duty at the moment, try again later !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "** %s is in need of a Medic. (use /accept medic to accept the call)", sendername);
SendRadioMessage(4, TEAM_AZTECAS_COLOR, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have called for a Medic, wait for a reply.");
MedicCall = playerid;
return 1;
}
if(strcmp(cmd, "/cure", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cure [PlayerID/PartOfName] [price]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cure [PlayerID/PartOfName] [price]");
return 1;
}
moneys = strvalEx(tmp);
if(moneys < 200 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, " Price can't be below $200 or above $1000 !"); return 1; }
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD1, " You cannot cure yourself !");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
new Float:tempheal;
GetPlayerHealth(giveplayerid,tempheal);
if(tempheal >= 100.0)
{
SendClientMessage(playerid, COLOR_GRAD1," That person is fully healed !");
return 1;
}
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+moneys;
GivePlayerMoney(playerid,moneys);
PlayerInfo[giveplayerid][pCash] = PlayerInfo[giveplayerid][pCash]-moneys;
GivePlayerMoney(giveplayerid,-moneys);
SetPlayerHealth(giveplayerid, 100);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(giveplayerid, COLOR_GRAD1, " You have been fully healed.");
format(string, sizeof(string), "* Paramedic %s has healed %s for $%d.", sendername,giveplayer,moneys);
TogglePlayerControllable(playerid, 1);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(STDPlayer[giveplayerid] > 0)
{
STDPlayer[giveplayerid] = 0;
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
return 1;
}
}
}
else
{
format(string, sizeof(string), " %d is not an active player !", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
if(strcmp("/acceptmedic", cmdtext, true, 10) == 0)
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
if(MedicCallTime[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " You have already accepted a Medic Call !");
return 1;
}
if(MedicCall < 999)
{
if(IsPlayerConnected(MedicCall))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(MedicCall, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You have accepted the Medic Call from %s, you have few minutes to get there, Type /cure to heal him.",giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* After the few minutes the Red Marker will disappear.");
format(string, sizeof(string), "* Medic %s has accepted your Medic Call please wait at your current Position.",sendername);
SendClientMessage(MedicCall, COLOR_LIGHTBLUE, string);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(MedicCall, X, Y, Z);
SetPlayerCheckpoint(playerid, X, Y, Z, 5);
GameTextForPlayer(playerid, "~w~Medic Caller~n~~r~Goto redmarker", 5000, 1);
MedicCallTime[playerid] = 1;
MedicCall = 999;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nobody called for a Medic yet !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Medic !");
return 1;
}
}
}
dcmd_acceptdeath(playerid, params[])
{
#pragma unused params
if (IsDead[playerid] == 0) { return 0; }
else
{
SetPlayerHealth(playerid, 0);
}
}
public AutoDeath(playerid)
{
if (IsDead[playerid] == 0) { return 0; }
else if (IsDead[playerid] == 1)
{
new saystring[128], deathstring[128], name[28];
GetPlayerName(playerid,name,sizeof(name));
switch (random(2))
{
case 0:
{
format(saystring,sizeof(saystring),"%s mumbles: I can't hold more..", name);
format(deathstring,sizeof(deathstring),"* %s closes his eyes, falling into death.", name);
}
case 1:
{
format(saystring,sizeof(saystring),"%s mumbles: Aghh.. It's cold.. I feel something.. A light-..",name);
format(deathstring,sizeof(deathstring),"* %s is now inmobilized, and dead.",name);
}
}
ProxDetector(30, playerid, deathstring, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
ProxDetector(10, playerid, saystring, WHITE,WHITE,WHITE,WHITE,WHITE);
SetPlayerHealth(playerid, 0);
return 1;
}
return 1;
}
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
}
}
return 1;
}