[FilterScript] [FS]OnPlayerUpdate Score to Money [0.3 and 0.2X compatible]
#1

Simple OnPlayerUpdate Score to Money by Alive.
Description:
When showing scoreboard (TAB) where is score shows your money. Hope you understood me.

Bugs:
Haven't found any. If you do reply here.

Download:
Failai.lt

Mirrors are NOT allowed
Cheers,
-Alive
Reply
#2

What the FUCK are you doing? are you trying to ruine or server or something?

Quote:

public OnPlayerUpdate(playerid)
{
new CashScore;
new CashScoreOld;

for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
CashScore = GetPlayerMoney(i);
SetPlayerScore(i, CashScore);
if(CashScore > CashScoreOld)
{
CashScoreOld = CashScore;
}
}
}
return 1;
}

OnPlayerUpdate get's called every like 20-30 times a second for each player.
So that like if you've 500 players (for 0.3): 500x20 = 100.000 x 500 (for the loop) = 50.000.000 times.

This function is calles 50.000.000 times each 1 second if your server is full....
Reply
#3

By the way loop is not needed here.
Reply
#4

Say me 5 things why I cant make it OnPlayerUpdate?
and thanks CracK, will make it better in next ver. :P
Reply
#5

I just wanna laugh for you script.
Reply
#6

Quote:
Originally Posted by Jakku
I just wanna laugh for you script.
Why laugh, I don't laugh about your script (stolen FS and claimed as your own) either?
Reply
#7

Are you trying to Kill somones server?
you cant put this on OnPlayerUpdate...... just make it a public and make a timer which does it every 1 minute or so. Also
Because its looping 50,000,000 times each second you're going to use soo much CPU and bandwidth,
Make a timer, every 1 minute because every second is STUPID.
Reply
#8

Common guys do normal to this guy
maby he is not good at Pawn scripting just help him
I don't know what script this is but try this:
Reply
#9

pawn Код:
public OnPlayerUpdate(playerid)
{
  ResetPlayerMoney(playerid);
  GivePlayerMoney(playerid, GetPlayerScore(playerid));
}
I figure that this script would start causing trouble if you had like ~100 players.

Actually, why not make it check for a change?
pawn Код:
new pOldScore[MAX_PLAYERS],
  pNewScore[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
  pNewScore[playerid] = GetPlayerScore(playerid);
  if(pNewScore[playerid] != pOldScore[playerid])
  {
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, pNewScore[playerid]);
  }
}
Or make it execute only if a certain amount of ticks is counted:
pawn Код:
new playerScoreTick[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
  if(playerScoreTick[playerid] == 100)
  {
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, GetPlayerScore(playerid));
    playerScoreTick[playerid] = 0;
  }
  else
  {
    playerScoreTick[playerid] = playerScoreTick[playerid] + 1;
  }
}
Or the BEST way to make your score transfer into your amount of money or otherwise is to actually change the score/money when you change the money/score. You know what I mean, this would require no usage of OnPlayerUpdate, just make your:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
into
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
GivePlayerMoney(playerid, GetPlayerScore(playerid));
Reply
#10

You could make timer for every player
  • Starts when player connect
  • Interval = one minute
pawn Код:
forward ScoreUpdate(playerid);
pawn Код:
public OnPlayerConnect(playerid)
{
    SetTimerEx("ScoreUpdate",60000,0,"i",playerid);
    return 1;
}
pawn Код:
public ScoreUpdate(playerid)
{
    SetPlayerScore(playerid,GetPlayerMoney(playerid));
    SetTimerEx("ScoreUpdate",60000,0,"i",playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)