Player Score - 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: Player Score (
/showthread.php?tid=257640)
Player Score -
aceisnice - 27.05.2011
What is a command i put put into my script so every game hour a player gets 2 score? And 200 $?
Re: Player Score -
cessil - 27.05.2011
you create a function that gives a player +2 score and $200 and then use a timer to execute it every game hour
Re: Player Score -
Elka_Blazer - 27.05.2011
On the top of your script
pawn Код:
forward GiveScoreMoney(playerid);
OnGameModeInIt
pawn Код:
public OnGameModeInIt()
{
SetTimer("GiveScoreMoney",x,true);//Replace x with the time you want
return 1;
}
Replace x with the time you want
Now
The public
pawn Код:
public GiveScoreMoney(playerid)
{
SetPlayerScore(playerid,GetPlayerScore(playerid) + 2);
GivePlayerMoney(playerid,200);
return 1;
}
Re: Player Score -
(SF)Noobanatior - 27.05.2011
i dont think the onee before will work as it wont pass the playerid right idea though
pawn Код:
public GiveScoreMoney()
{
for(new i=0;i<MAX_PLAYERS;i++){
if(!IsPlayerConnected(i))continue;
SetPlayerScore(i,GetPlayerScore(playerid) + 2);
GivePlayerMoney(i,200);
}
return 1;
}
this should do it
and a standard game hour is 1min so your time would be 60000
Re: Player Score -
Mean - 27.05.2011
No, both of u wrong...
pawn Код:
public OnGameModeInit( )
{
SetTimer( "ScoreMoney", 60 * 60000, 1 );
return 1;
}
forward ScoreMoney( ); // You don't need the "playerid" param here, leave it empty.
public ScoreMoney( )
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if( IsPlayerConnected( i ) )
GivePlayerMoney( i, 200 ),
SetPlayerScore( i, GetPlayerScore( i ) + 2 );
}
return 1;
}
Re: Player Score -
(SF)Noobanatior - 27.05.2011
your right on the playerid teach me for editing lol
but 60 * 60000 is a real hour not a game hour
Re: Player Score -
Elka_Blazer - 27.05.2011
LOL fails ... doesnt matter will work anyways ... works on every script I tested
Re: Player Score -
aceisnice - 27.05.2011
Thanks Guy, Testing now
Re: Player Score -
aceisnice - 27.05.2011
Did not work
Re: Player Score -
Lorenc_ - 28.05.2011
pawn Код:
public OnGameModeInit( )
{
SetTimer( "ScoreMoney", 24 * 60 * 1000, true);//thats like a whole day in game
return 1;
}
forward ScoreMoney();
public ScoreMoney()
{
foreach(Player, i)
{
if(!IsPlayerConnected(i)) continue;
GivePlayerMoney(i, 200);
SetPlayerScore(i, GetPlayerScore(i) + 2);
}
}
using foreach, i dont see whats possibly wrong?