Script Tutorial For A Score System Please -
ryan_parkour - 03.02.2011
Hi guys and girlies
I want to know if any of you know how to make a script where your money becomes your score?
That would really help
Thank You! ^^
Re: Script Tutorial For A Score System Please -
hadzx - 03.02.2011
what do you mean like instead of getting money for doing something you get score?
Re: Script Tutorial For A Score System Please -
ryan_parkour - 03.02.2011
When you stunt, you get money, but I want the score to be the money
Re: Script Tutorial For A Score System Please -
Steven Paul - 03.02.2011
you did not fully described what you need, so this thing might help you
https://sampforum.blast.hk/showthread.php?tid=207768
Re: Script Tutorial For A Score System Please -
ryan_parkour - 03.02.2011
when you do a stunt, you get money, right??
Now, when you have money. the score must always be set to the player's money
eg. a guys stunts, gets $100-his score will then be set to 100, he does another stunt, this time he gets $120- the score adds 120 on to it. Get what Imean?
Re: Script Tutorial For A Score System Please -
Steven Paul - 03.02.2011
I don't think that's possible
Re: Script Tutorial For A Score System Please -
Ihsan-Cingisiz - 03.02.2011
Quote:
Originally Posted by Steven Paul
I don't think that's possible
|
It is possible.
Paste this above your scrtip, under the includes and defines:
pawn Код:
forward MoneyTimer(playerid);
Paste this in OnGameModeInit:
pawn Код:
SetTimer("MoneyTimer", 15000, true); // Each 15 seconds the score will be updated.
Paste this somewhere in your script:
pawn Код:
public MoneyTimer(playerid)
{
new money = GetPlayerMoney(playerid);
SetPlayerScore(playerid, money);
}
This will update each 15 second your score display and your money
will be shown at if you press tab for example. Anyways, i hope this
was were you was searching for..
AW: Script Tutorial For A Score System Please -
Nero_3D - 03.02.2011
@Ihsan-Cingisiz
You code only works for playerid 0, you dont loop through all players
@Topic
The OnPlayerKeyStateChange version
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_ACTION) == KEY_ACTION) {
for(newkeys = -1; (++newkeys) != MAX_PLAYERS; )
SetPlayerScore(newkeys, GetPlayerMoney(newkeys));
}
}
The only disadvantage is that OnPlayerKeyStateChange only works if the player is spawned which results in no update if you arent spawned
Re: Script Tutorial For A Score System Please -
ryan_parkour - 03.02.2011
Quote:
Quote:
Originally Posted by Steven Paul
I don't think that's possible
It is possible.
Paste this above your scrtip, under the includes and defines:
pawn Code:
forward MoneyTimer(playerid);
Paste this in OnGameModeInit:
pawn Code:
SetTimer("MoneyTimer", 15000, true); // Each 15 seconds the score will be updated.
Paste this somewhere in your script:
pawn Code:
public MoneyTimer(playerid)
{
new money = GetPlayerMoney(playerid);
SetPlayerScore(playerid, money);
}
This will update each 15 second your score display and your money
will be shown at if you press tab for example. Anyways, i hope this
was were you was searching for..
|
I'm Testing it now..
Re: Script Tutorial For A Score System Please -
ryan_parkour - 03.02.2011
for some reason, i'm not getting money when doing stunts... 0_o