SA-MP Forums Archive
Create a red point? - 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: Create a red point? (/showthread.php?tid=86230)



Create a red point? - krawN - 12.07.2009

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!


Re: Create a red point? - MenaceX^ - 12.07.2009

SetPlayerCheckpoint?


Re: Create a red point? - -Sneaky- - 12.07.2009

It's called a checkpoint:

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint


Re: Create a red point? - krawN - 12.07.2009

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


Re: Create a red point? - member - 12.07.2009

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.


Re: Create a red point? - krawN - 12.07.2009

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

Bye and thanks!!


Re: Create a red point? - krawN - 12.07.2009

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


Re: Create a red point? - member - 12.07.2009

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.