Score it money
#1

Hi I want the score is the money the player has
Reply
#2

SetPlayerScore(playerid, PlayerInfo[playerid][pMoney]);

That is simple
Reply
#3

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;
}
Reply
#4

Quote:
Originally Posted by MasonSFW
Посмотреть сообщение
GetPlayerScore(playerid, PlayerInfo[playerid][pMoney]);

That is simple
Thanks, but where is it going?
Reply
#5

SetPlayerMoney i was wrong sorry :P Put it when player loggedin
Reply
#6

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;
}
Reply
#7

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...
Reply
#8

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)