Create a red point?
#1

Hello, I'm new here.

Today I've played to one server where when you stay more than X seconds to one red point something happens, for example, you win 5000 $ or something... I wanna know how to create a red point and make a function for him. Is there any tutorial or someone who can explain me? Thanks!
Reply
#2

SetPlayerCheckpoint?
Reply
#3

It's called a checkpoint:

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint
Reply
#4

Yeah, ok, it is. Thanks, so, could be possible do a timer with it? For example, if I'm more than 20 seconds in one checkpoints win something then, not just when you goes there. How I could do it?

Thanks
Reply
#5

Quote:
Originally Posted by krawN
Yeah, ok, it is. Thanks, so, could be possible do a timer with it? For example, if I'm more than 20 seconds in one checkpoints win something then, not just when you goes there. How I could do it?

Thanks
That is possible. You'll need OnPlayerEnterCheckpoint ( https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint )
Then when the player enters the checkpoint it should set a timer off for that person - SetTimerEx ( https://sampwiki.blast.hk/wiki/SetTimerEx )

Good Luck.
Reply
#6

Oh, ok, thanks a lot I'll do it now.

Bye and thanks!!
Reply
#7

I'm trying to do it but when I go to checkpoints nothing happens.

Quote:

public OnPlayerEnterCheckpoint(playerid)
{
SetTimerEx("test", 1, false, "is", 1, "string to pass");
return 1;
}

forward test(playerid);
public test(playerid)
{

GivePlayerMoney(playerid, 1000);
DisablePlayerCheckpoint(playerid);
return 1;
}

Any help? Thanks
Reply
#8

Your on the right tracks, only a few minor problems
You need to tell the timer which arguments to pass as accoridng to the wiki. We can see that you will need "playerid" handy to execute the Test function correctly., otherwise pawn wouldn't know what "playerid" is since "Test" is a custom function

Also the format should be "d" since playerid is an integer and not a string

Here's what it should look like:

pawn Code:
SetTimerEx("Test", 5000, false, "d", playerid);

forward Test(playerid);

public Test(playerid)
{
    GivePlayerMoney(playerid, 1000);
    DisablePlayerCheckpoint(playerid);
    SendClientMessage(playerid,0x48FF48FF,"Congratulations, You have won $1000");
}
The timer will execute after 5 seconds.

Good Luck.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)