Help with one thing (+rep)
#1

Hello,

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1629.9722,147.9344,35.5146))
    {
        CreateBox(playerid, "info", "Welcome to las venturas");
    }
This is the position of the right side on the highway which shows a message to a player "welcome to las venturas"

I use this at a 100ms timer, is it good or should i use it somewhere else?

And is there a way that this message shows only one time? instead that it spams if player stops at that position
Reply
#2

I'd recommend something like this:

pawn Код:
new W2LV[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    if(W2LV[playerid] != 1)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, 1629.9722,147.9344,35.5146))
        {
            CreateBox(playerid, "info", "Welcome to las venturas");
            W2LV[playerid] = 1;
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    W2LV[playerid] = 0;
    return 1;
}
Reply
#3

To show it once, you could create a variable...

EG:

pawn Код:
new BoxShown[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    BoxShown[playerid] = 0;
}

if(IsPlayerInRangeOfPoint(playerid, 5.0, 1629.9722,147.9344,35.5146))
{
    if(BoxShown[playerid] == 0) //This checks if the box is allowed to be shown.
    {
        CreateBox(playerid, "info", "Welcome to las venturas");
        BoxShown[playerid] = 1; //This states that the box shouldn't be shown again.
    }
}
Edit: Above, you beat me. Nice
Reply
#4

Thats good, but now i want that if player has W2LV set to 1, that it resets in 1 minute ;p
Reply
#5

Then to this:

pawn Код:
SetTimerEx("RemoveW2LV", 60000, 0, "i", playerid);

forward RemoveW2LV(playerid);
public RemoveW2LV(playerid)
{
    W2LV[playerid] = 0;
}
Reply
#6

pawn Код:
forward ReseW2LV(playerid);

public ResetW2LV(playerid)
{
    W2LV[playerid] = 0;
}

public OnPlayerUpdate(playerid)
{
    if(W2LV[playerid] != 1)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, 1629.9722,147.9344,35.5146))
        {
            CreateBox(playerid, "info", "Welcome to las venturas");
            W2LV[playerid] = 1;
                SetTimerEx("ResetW2LV", 60000, false, "i", playerid);
        }
    }
    return 1;
}
Reply
#7

Thanks +rep for both

@Jack, must spread some, will give you later
Reply
#8

Thank you buddy
Reply
#9

Quote:
Originally Posted by Dripac
Посмотреть сообщение
Thanks +rep for both

@Jack, must spread some, will give you later
All good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)