06.03.2014, 14:08
I want doctors to be able to do the command outside the ambulance. Can someone change the code for me?
PHP код:
if(strcmp(cmd, "/heal", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{7DAEFF}USAGE: /heal [playerid/PartOfName] [price]{7DAEFF}");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "{7DAEFF}USAGE: /heal [playerid/PartOfName] [price{7DAEFF}]");
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 heal yourself.");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new giveambu = GetPlayerVehicleID(giveplayerid);
new playambu = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
if(IsAnAmbulance(playambu) && playambu == giveambu)
{
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);
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 and the patient must be inside the Ambulance !");
return 1;
}
}
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;
}