[Help] /Heal in Ammu Nation isn't working - 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: [Help] /Heal in Ammu Nation isn't working (
/showthread.php?tid=81260)
[Help] /Heal in Ammu Nation isn't working -
xXiamCr4zyXx - 09.06.2009
Hey i wanted to make a script that when you go in Ammu Nation and type /heal it would actually heal you. Here's my script so far:
Код:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(text, "/heal", true)==0)
{
SetPlayerHealth(playerid, 100.0);
}
if isPlayerInArea ()
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,254,287.5830,-39.4381,1001.5156,302.302.2461,0,0,0,0,0,0);
{
SendClientMessage(playerid, COLOR_RED, "You have been healed");
{
else
}
SendClientMessage(playerid, COLOR_RED, "Unknown command");
{
return 1;
}
}
I think its something wrong with that GetPlayerPos and stuff oh and that location is Ammu Nation in LS.
Help would be appreciated.
Regards xXiamCr4zyXx
From Slovenia
Re: [Help] /Heal in Ammu Nation isn't working -
MPKaboose - 09.06.2009
use playertopoint and not getplayerpos since that will only get the player position but will not look if the player is there
Re: [Help] /Heal in Ammu Nation isn't working -
dice7 - 09.06.2009
pawn Код:
forward IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y); //top of script
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/heal", true)==0)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x, y, z);
if IsPlayerInArea(playerid,max_x, min_x, max_y, min_y) // change max_x, max_y, min_x and min_y so they will be around ammunations position
{
SendClientMessage(playerid, 0xAA3333AA, "You have been healed");
SetPlayerHealth(playerid, 100.0);
}
return 1;
}
return 1;
}
//the IsPlayerInArea function
stock IsPlayerInArea(playerid, Float:max_x, Float:min_x, Float:max_y, Float:min_y)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X <= max_x && X >= min_x && Y <= max_y && Y >= min_y) return 1;
return 0;
}
Re: [Help] /Heal in Ammu Nation isn't working -
xXiamCr4zyXx - 09.06.2009
Thanks a lot guys