stats help - 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: stats help (
/showthread.php?tid=439208)
stats help -
MichaelWharton101 - 24.05.2013
So I have made a stats but I got a prob...
Код:
format(string, sizeof(string), "VIP: %s - VIP Points: %d - Total Donations: $%d - Shop Coupon: $%d", RPVIPN(playerb), PlayerInfo[playerid][pLPoints], PlayerInfo[playerb][pDonations], PlayerInfo[playerb][pCoupon]);
SendClientMessage(playerid, COLOR_VIP, string);
if(PlayerInfo[playerid][pVIP]) format(string, sizeof(string), "VIP Expiration: %d/%d/2013", PlayerInfo[playerid][pVIPMonth], PlayerInfo[playerid][pVIPDay]);
SendClientMessage(playerid, COLOR_VIP, string);
Now what is red should only show up if you are a VIP, But now if you are not VIP you see the line that is blue twice, But you no longer see the red line... Any idea how to fix this?
Re: stats help -
MichaelWharton101 - 25.05.2013
Anyone at all?
Re: stats help -
DobbysGamertag - 25.05.2013
Have you tried an if statement?
Re: stats help -
MichaelWharton101 - 25.05.2013
What do you mean?
Re: stats help -
DobbysGamertag - 25.05.2013
if they are a vip. show the correct line to them.
if they aren't VIP, show them the other line, or other applicable ones
It's called
control structures
Re: stats help -
MichaelWharton101 - 25.05.2013
I don't think I would need to do that though.
AW: stats help -
Skimmer - 25.05.2013
Try this?
pawn Код:
format(string, sizeof(string), "VIP: %s - VIP Points: %d - Total Donations: $%d - Shop Coupon: $%d", RPVIPN(playerb), PlayerInfo[playerid][pLPoints], PlayerInfo[playerb][pDonations], PlayerInfo[playerb][pCoupon]);
SendClientMessage(playerid, COLOR_VIP, string);
if(PlayerInfo[playerid][pVIP])
{
format(string, sizeof(string), "VIP Expiration: %d/%d/2013", PlayerInfo[playerid][pVIPMonth], PlayerInfo[playerid][pVIPDay]);
SendClientMessage(playerid, COLOR_VIP, string);
}
Your problem was here
pawn Код:
if(PlayerInfo[playerid][pVIP]) format(string, sizeof(string), "VIP Expiration: %d/%d/2013", PlayerInfo[playerid][pVIPMonth], PlayerInfo[playerid][pVIPDay]);
SendClientMessage(playerid, COLOR_VIP, string);
See the if- Line. If you're vip it formats the string. But if you're not it doesn't. Because of that sends the server last formatted text. So the Blue marked text again.