[Help] /Heal in Ammu Nation isn't working
#1

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
Reply
#2

use playertopoint and not getplayerpos since that will only get the player position but will not look if the player is there
Reply
#3

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;
}
Reply
#4

Thanks a lot guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)