Score it money - 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)
+--- Thread: Score it money (
/showthread.php?tid=537352)
Score it money -
LeanAlex - 14.09.2014
Hi I want the score is the money the player has
Re: Score it money -
MasonSFW - 14.09.2014
SetPlayerScore(playerid, PlayerInfo[playerid][pMoney]);
That is simple
Re: Score it money -
Eth - 15.09.2014
no he doesn't mean that, he means that he wants the score to be the same as player's money...
You can do that by using:
onplayerconnect make every second timer when a player connect:
pawn Код:
SetTimerEx("ScoreMoney", 1000, 1, "i", playerid);
add those functions:
pawn Код:
forward ScoreMoney(playerid);
public ScoreMoney(playerid)
{
SetPlayerScore(playerid,GetPlayerMoney(playerid));
return 1;
}
Respuesta: Re: Score it money -
LeanAlex - 15.09.2014
Quote:
Originally Posted by MasonSFW
GetPlayerScore(playerid, PlayerInfo[playerid][pMoney]);
That is simple
|
Thanks, but where is it going?
Re: Score it money -
MasonSFW - 15.09.2014
SetPlayerMoney i was wrong sorry :P Put it when player loggedin
Re: Score it money -
SanAndreasMP - 15.09.2014
You can also do it in other ways though :
pawn Код:
public OnPlayerSpawn(playerid)// Maybe your script will give money to player after spawning.
{
SetTimerEx("ScoreMoney", 500, true, "i", playerid);
return true;
}
public ScoreMoney(playerid)
{
SetPlayerScore(playerid, GetPlayerMoney(playerid)); // This will get the player's money and will assing it to his/her score.
return true;
}
Re: Score it money -
Eth - 15.09.2014
Quote:
Originally Posted by SanAndreasMP
You can also do it in other ways though :
pawn Код:
public OnPlayerSpawn(playerid)// Maybe your script will give money to player after spawning. { SetTimerEx("ScoreMoney", 500, true, "i", playerid); return true; }
public ScoreMoney(playerid) { SetPlayerScore(playerid, GetPlayerMoney(playerid)); // This will get the player's money and will assing it to his/her score. return true; }
|
you have forgot the ScoreMoney forward. + I did that one already...
Re: Score it money -
SilentSoul - 15.09.2014
I wouldn't recommend you to use timers for such things thats just a waste of memory, you should update the player score once you give him money only.
pawn Код:
stock GiveMoney(playerid,amount)
{
GivePlayerMoney(playerid,amount);
SetPlayerScore(playerid,GetPlayerMoney(playerid));
return true;
}
//later usage should be GiveMoney instead of GivePlayerMoney. for example:
public OnPlayerSpawn(playerid)
{
GiveMoney(playerid,100);
return 1;
}