SetPlayerScore With OnPlayerUpdate?
#1

I was just wondering For like every 1 minute they play, the earn 5 points, How would I do that? I just thought of using OnPlayerUpdate, but I have no clue how to make that work

any help please?
Reply
#2

Use a timer and loop through all players
Reply
#3

pawn Код:
forward ScoreUpdate();
pawn Код:
//OnGameModeInit
SetTimer("ScoreUpdate", 60000, true);
pawn Код:
public ScoreUpdate()
{
for(new i; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
SetPlayerScore(i, GetPlayerScore(i)+5);
}
}
return 1;
}
Reply
#4

Quote:
Originally Posted by dice7
Use a timer and loop through all players
Thanks Lets just hope I can figure out that.

EDIT:

Thanks Conroy.

EDIT AGAIN:

Thanks Joe Torran!
Reply
#5

pawn Код:
forward ScoreUpdate(playerid);
new timer;

public OnPlayerConnect(playerid)
{
  timer = SetTimerEx("ScoreUpdate", 60*1000, 1, "i", playerid);
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  KillTimer(timer);
  return 1;
}

public ScoreUpdate(playerid)
{
  SetPlayerScore(playerid, GetPlayerScore(playerid)+5);
  return 1;
}
Reply
#6

My way is much more easier.
Reply
#7

Quote:
Originally Posted by Conroy
My way is much more easier.
He said for every minute they play, Not every minute the server is running
Reply
#8

Yes, it only gives score if the player is connected.
Reply
#9

Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by Conroy
My way is much more easier.
He said for every minute they play, Not every minute the server is running
Thats correct Joe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)