16.05.2011, 16:09
This is my new heal command wich is working thanks to Sven who told me just how to solve an error line(Thanks),now in game evrything works evrything,but there's one problem about it when I type /heal 0(me) server shuts down and I think I know the problem(I can't heal my self probably) and I didn't make the IsPlayerConnected shit:
pawn Код:
COMMAND:heal(playerid,params[])
{
if(gTeam[playerid] == TEAM_MEDICS)
{
new p1;
new p2;
new Float:health;
if(sscanf(params,"u",p2)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /heal [id]");
GetPlayerHealth(p2,health);
if(health < 80)
{
GetDistanceBetweenPlayers(p1,p2);
if(GetDistanceBetweenPlayers(p1,p2) > 5) return SendClientMessage(p1,COLOR_RED,"Player is too far away");
if(GetDistanceBetweenPlayers(p1,p2) < 5)
{
SetPlayerHealth(p2,100);
GivePlayerMoney(p2,-500);
GivePlayerMoney(p1,500);
SendClientMessageToAll(COLOR_PURPLE,"Player %s has been healed by medic %s");
}
}
if(health > 80) return SendClientMessage(playerid,COLOR_GREEN,"The player doesn't need to be healed");
}
if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_ROBBERS || gTeam[playerid] == TEAM_FIREFIGHTERS)
{
SendClientMessage(playerid,COLOR_RED,"This command is only for medics.");
return 1;
}
return true;
}