SA-MP Forums Archive
GivePlayerMoney With Timer - 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)
+--- Thread: GivePlayerMoney With Timer (/showthread.php?tid=509729)



GivePlayerMoney With Timer - RedbullGD - 27.04.2014

Hey Guys.Hope Everything's fine
Guys i just want to learn that how do i give player money and score using timer
Please help.


Re: GivePlayerMoney With Timer - StuartD - 27.04.2014

You're gonna need to read the following.

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/GivePlayerMoney
https://sampwiki.blast.hk/wiki/SetPlayerScore


Re: GivePlayerMoney With Timer - RedbullGD - 27.04.2014

Quote:
Originally Posted by StuartD
Посмотреть сообщение
StuartD Thank You For Your Precious Time.
But i still don't get how to do it.
Can u please give a example code please.


AW: GivePlayerMoney With Timer - Macronix - 27.04.2014

Here you go:

pawn Код:
forward GiveUserScoreAndMoney();
public GiveUserScoreAndMoney()
{
    for(new i=0; i < MAX_PLAYERS; i++) // A loop to go through every player
    {
        if(!IsPlayerConnected(i)) continue; // If player is not connected, then continue the loop
        GivePlayerMoney(i, 5000); // Gives every player $5000
        SetPlayerScore(i, GetPlayerScore(i)+5); //Gets every players score and increases it by 5
    }
    return 1;
}

//In OnGameModeInit:
SetTimer("GiveUserScoreAndMoney", 5000, true); // 5000 = 5 seconds (or 5000 ms) and true means that the timer repeats every 5 seconds



Re: AW: GivePlayerMoney With Timer - RedbullGD - 28.04.2014

Quote:
Originally Posted by Macronix
Посмотреть сообщение
Here you go:

pawn Код:
forward GiveUserScoreAndMoney();
public GiveUserScoreAndMoney()
{
    for(new i=0; i < MAX_PLAYERS; i++) // A loop to go through every player
    {
        if(!IsPlayerConnected(i)) continue; // If player is not connected, then continue the loop
        GivePlayerMoney(i, 5000); // Gives every player $5000
        SetPlayerScore(i, GetPlayerScore(i)+5); //Gets every players score and increases it by 5
    }
    return 1;
}

//In OnGameModeInit:
SetTimer("GiveUserScoreAndMoney", 5000, true); // 5000 = 5 seconds (or 5000 ms) and true means that the timer repeats every 5 seconds
Macronix I Really Appreciate Your Time.But I'm Not Putting It In The GameMode Cause I Don't Have The Game Mode Then What Can I Do Now?


Re: GivePlayerMoney With Timer - JeaSon - 28.04.2014

if you wanted to use as fs then
add following line under OnFilterscriptInit

pawn Код:
//put it under public OnFilterScriptInit()
SetTimer("GiveUserScoreAndMoney", 5000, true); // 5000 = 5 seconds (or 5000 ms) and true means that the timer repeats every 5 seconds



Re: GivePlayerMoney With Timer - RedbullGD - 28.04.2014

Quote:
Originally Posted by Namer
Посмотреть сообщение
if you wanted to use as fs then
add following line under OnFilterscriptInit

pawn Код:
//put it under public OnFilterScriptInit()
SetTimer("GiveUserScoreAndMoney", 5000, true); // 5000 = 5 seconds (or 5000 ms) and true means that the timer repeats every 5 seconds
Namer Thank You For Your Precious Time.
Rep++