if(strcmp(cmd, "/med", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1) // faction id 1 (medic)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /med [playerid]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new Float:HP;
GetPlayerHealth(playerid,HP);
if(HP < 100
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already healed");
return 1;
}
// something here
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't heal yourself"); return 1; }
format(string, sizeof(string), "[INFO:] Healed by %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_LIGHTYELLOW2, string);
format(string, sizeof(string), "[INFO:] %s successfully Healed.", GetPlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_WHITE, string);
PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just Healed");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
return 1;
}
}
|
Originally Posted by [LCG
TANKER ]
ive been thinking about this, would it be posible to heal a player if they are near or in a ambulance? here is what i have so far Код:
if(strcmp(cmd, "/med", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1) // faction id 1 (medic)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /med [playerid]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new Float:HP;
GetPlayerHealth(playerid,HP);
if(HP < 100
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already healed");
return 1;
}
// something here
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't heal yourself"); return 1; }
format(string, sizeof(string), "[INFO:] Healed by %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_LIGHTYELLOW2, string);
format(string, sizeof(string), "[INFO:] %s successfully Healed.", GetPlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_WHITE, string);
PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just Healed");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
return 1;
}
}
|
if(strcmp(cmd, "/heal", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2)
{
giveplayerid = ReturnUser(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[INFO:] /heal [playerid/PartOfName]");
return 1;
}
tmp = strtok(cmdtext, idx);
if (giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can not heal yourself!");
return 1;
}
if(giveplayerid != INVALID_PLAYER_ID)
{
new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new giveambu = GetPlayerVehicleID(giveplayerid);
new playambu = GetPlayerVehicleID(playerid);
{
if (IsAnAmbulance(playambu) && playambu == giveambu)
{
new Float:tempheal;
GetPlayerHealth(giveplayerid,tempheal);
if(tempheal >= 100.0)
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2," [ERROR:]That person is fully healed.");
return 1;
}
GameTextForPlayer(playerid, string, 5000, 1);
new hp = 100;
SetPlayerHealth(giveplayerid, 100);
format(string, sizeof(string), "[INFO:]You have been healed to %d health",hp);
SendClientMessage(giveplayerid, COLOR_LIGHTYELLOW2,string);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[INFO:]One of you is not in the Ambulance / Chopper!");
return 1;
}
}
}
else
{
format(string, sizeof(string), "[ERROR:]%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid Faction.");
return 1;
}
}
return 1;
}