SA-MP Forums Archive
checkpoint with money - 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: checkpoint with money (/showthread.php?tid=189703)



checkpoint with money - unforgiving - 12.11.2010

remove this too


Re: checkpoint with money - iownafiretruck - 13.11.2010

youll have to use a timer for this, take a look here
https://sampwiki.blast.hk/wiki/SetTimerEx


Re: checkpoint with money - Kitten - 13.11.2010

Not tested
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new MoneyT;
    MoneyT = SetTimer("Every1Second",1000,true);
    if(!IsPlayerInAnyVehicle(playerid)) {
    GivePlayerMoney(playerid,GetPlayerMoney(playerid)+ 1);
    return 1;
}
forward Every1Second(playerid);
public Every1Second(playerid)
{
    if(!IsPlayerInAnyVehicle(playerid)) {
    GivePlayerMoney(playerid,GetPlayerMoney(playerid)+ 1);
    return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
    KillTimer(MoneyT);
    return 1;
}



Re: checkpoint with money - iggy1 - 13.11.2010

It's probably also worth mentioning that if you don't use IsPlayerInRangeOfPoint (or streamer with checkpoint ids) with your checkpoint co-ords the script wont know which checkpoint you want to give money, so all checkpoints will give cash.

EDIT: eg,
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, RANGE, x , y, z)//swap range for the size of the checkpoint and x, y, z for the coordinates of the checkpoint
    {
        new MoneyT;
        MoneyT = SetTimer("Every1Second",1000,true);
        if(!IsPlayerInAnyVehicle(playerid)) {
        GivePlayerMoney(playerid,GetPlayerMoney(playerid)+ 1);
    }
    return 1;
}