HELP NEEDED!! - 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: HELP NEEDED!! (
/showthread.php?tid=198521)
HELP NEEDED!! -
Jack_Rocker - 12.12.2010
Basically, i know this sounds noobish, but how could I make a person earn 1 point (score) for every minute they're online?
Thanks in advance!
Re: HELP NEEDED!! -
blackwave - 12.12.2010
pawn Код:
forward score(playerid); // TOP
pawn Код:
public OnPlayerConnect(playerid)
{
SetTimerEx("score", 60000, true, "i");
return 1;
}
pawn Код:
public score(playerid) // END
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
return 1;
}
Re: HELP NEEDED!! -
Ironboy500[TW] - 12.12.2010
Your SetTimerEx should look like this
Код:
SetTimerEx("score", 60000, true, "d", playerid);
Re: HELP NEEDED!! -
Benjo - 12.12.2010
Just a slight alteration to blackwave's solution so that it can handle player IDs being reused as players disconnect and connect.
pawn Код:
forward Score(playerid); // TOP
new gScoreTimer[MAX_PLAYERS]; // TOP
pawn Код:
public OnPlayerConnect(playerid)
{
gScoreTimer[playerid] = SetTimerEx("Score", 60000, true, "i", playerid);
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid)
{
KillTimer(gScoreTimer[playerid]);
return 1;
}
pawn Код:
public Score(playerid) // END
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
return 1;
}
Re: HELP NEEDED!! -
Jack_Rocker - 12.12.2010
thanks it works fine