Medic Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Medic Command (
/showthread.php?tid=275208)
Medic Command -
Alex_Obando - 08.08.2011
When the player do /heal and his ID he can heal himself how to disable that?
pawn Код:
new index;
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/heal", true) == 0)
{
if( gPlayerClass[playerid] != MEDIC ) return SendClientMessage(playerid, COLOR_RED, "You are not a Medic!");
new id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
if(healedrec[playerid] != 1)
{
new Float:gX, Float:gY, Float:gZ;
GetPlayerPos(id, gX, gY, gZ);
if( IsPlayerInRangeOfPoint(playerid, 5.0, gX, gY, gZ) )
{
SetPlayerHealth(id, 99.0);
SendClientMessage(id, 0x00FF00AA, "You've been healed by a medic!");
SendClientMessage(playerid, 0x00FF00AA, "Player healed.");
SendClientMessage(playerid, COLOR_RED, "You may heal again in 15 seconds.");
healedrec[playerid] = 1;
SetTimerEx("HealAgain", 15000, 0, "i", playerid);
}else SendClientMessage(playerid, COLOR_RED, "You need to be near the player to heal him !");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You have healed a player recently!");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /heal <id>");
}
return 1;
}
Re: Medic Command -
Scarred - 08.08.2011
pawn Код:
if(id == playerid) return SendClientMessage(playerid, -1, "{FFFFFF}You cannot heal yourself!");
Re: Medic Command -
wouter0100 - 08.08.2011
Код:
If(playerid == id){
Return 1;
}
Sorry for this small reply, but iam on my mobile :P
Respuesta: Medic Command -
Alex_Obando - 08.08.2011
pawn Код:
C:\Users\Alex\Desktop\Otros\CodSamp\codsamp_aw\gamemodes\COD5.pwn(7274) : error 017: undefined symbol "id"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Re: Medic Command -
Scarred - 08.08.2011
pawn Код:
if( IsPlayerInRangeOfPoint(playerid, 5.0, gX, gY, gZ) )
{
if(id == playerid) return SendClientMessage(playerid, -1, "{FFFFFF}You cannot heal yourself!");
SetPlayerHealth(id, 99.0);
SendClientMessage(id, 0x00FF00AA, "You've been healed by a medic!");
SendClientMessage(playerid, 0x00FF00AA, "Player healed.");
SendClientMessage(playerid, COLOR_RED, "You may heal again in 15 seconds.");
healedrec[playerid] = 1;
SetTimerEx("HealAgain", 15000, 0, "i", playerid);
}
Are you putting it like that?
Re: Medic Command -
wouter0100 - 08.08.2011
You have it after
* * * * * * if (IsPlayerConnected(id))
?
Re : Medic Command -
Soumi - 08.08.2011
pawn Код:
new index;
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/heal", true) == 0)
{
if( gPlayerClass[playerid] != MEDIC ) return SendClientMessage(playerid, COLOR_RED, "You are not a Medic!");
new id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
if(playerid != id)
{
if(healedrec[playerid] != 1)
{
new Float:gX, Float:gY, Float:gZ;
GetPlayerPos(id, gX, gY, gZ);
if( IsPlayerInRangeOfPoint(playerid, 5.0, gX, gY, gZ) )
{
SetPlayerHealth(id, 99.0);
SendClientMessage(id, 0x00FF00AA, "You've been healed by a medic!");
SendClientMessage(playerid, 0x00FF00AA, "Player healed.");
SendClientMessage(playerid, COLOR_RED, "You may heal again in 15 seconds.");
healedrec[playerid] = 1;
SetTimerEx("HealAgain", 15000, 0, "i", playerid);
}else SendClientMessage(playerid, COLOR_RED, "You need to be near the player to heal him !");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You have healed a player recently!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can't heal yourself!");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /heal <id>");
}
return 1;
}
Respuesta: Medic Command -
Alex_Obando - 08.08.2011
Oh, Tnx +1 Reputation!
SOLVED