GivePlayerMoney With Timer
#1

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.
Reply
#2

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
Reply
#3

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.
Reply
#4

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
Reply
#5

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?
Reply
#6

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
Reply
#7

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++
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)