Help with safezone text
#1

Hi all. I try to make a function like this: when player is safe zone, player recive a message with that.
pawn Код:
forward SafeZone(playerid);
public SafeZone(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 155,1642.0690,-2241.6035,13.4940))
    {
    SCM(playerid, -1, "You are in the safe zone. DON'T SHOT ANYBODY.");
    }
    return 1;
}
With this code the player is not reciving any message.
I have no ideea what i need to do
Reply
#2

Because Range (the second parameter) must be a float. It didn't work because you typed an integer (155), not a float (https://sampwiki.blast.hk/wiki/Float). I changed the code, it's ready for use. But I suggest you use a timer or else the chat will be spammed with the message. You might want to change the range aswell, 155.0 seems a little too much.

pawn Код:
forward SafeZone(playerid);
public SafeZone(playerid)
{
    //IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
    if(IsPlayerInRangeOfPoint(playerid, 155.0 ,1642.0690,-2241.6035,13.4940))
    {
    SCM(playerid, -1, "You are in the safe zone. DON'T SHOT ANYBODY.");
    }
    return 1;
}
Reply
#3

I don't get it can you explain me? and the code is not working.
Reply
#4

Someone can give me a good code?
Reply
#5

Where are you calling the function?
Reply
#6

Under ongamemodeint
Reply
#7

Well it's obviously not going to work there. Put it under OnPlayerUpdate and create a timer, so the message isn't sent every second or less.
Reply
#8

i got it. thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)