From Number To A Word.
#1

I got one question.

I'm trying to make login message when player spawns he'll get message.
This is my code so far...
pawn Код:
new pVipRank = Player[playerid][VipRank];
new pAdminLevel = Player[playerid][AdminLevel];
new pLevel = Player[playerid][Level];
format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: %d | Admin Level: %d |", Name, pLevel, pVipRank, pAdminLevel);
SendClientMessage(playerid, COLOR_ONLOGIN, string);
I'm trying to make when it says "VIP:..." that he tells me if he is: "Yes" or if he isn't "No".
He's now just puting me a number like "VIP: 1"

Any help?
Reply
#2

pawn Код:
format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: %s | Admin Level: %d |", Name, pLevel, pVipRank ? "Yes" : "No", pAdminLevel);
SendClientMessage(playerid, COLOR_ONLOGIN, string);
Reply
#3

Emmm...I don't think that's the way..
This just gives me a bunch of errors...
Reply
#4

Код:
new pVipRank = Player[playerid][VipRank];new pAdminLevel = Player[playerid][AdminLevel];new pLevel = Player[playerid][Level];format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: %d | Admin Level: %d |", Name, pLevel, pVipRank, pAdminLevel);SendClientMessage(playerid, COLOR_ONLOGIN, string);
There is several ways to do it, i'm sure on 3 ways, but i'll give you only 1 way for now:
1. Store Yes or No in a variable depending on a user then display it on the message.
2. Check the variable 1 and 0 and create a message for both with if statements.
3. Or Create another variable which you store yes or no in it, then When someone log on you save either yes or no then use that in the message.

Код:
new pVipRank = Player[playerid][VipRank];
new pAdminLevel = Player[playerid][AdminLevel];
new pLevel = Player[playerid][Level];
if(!pVipRank) {  // If pVipRank = 0
format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: NO | Admin Level: %d |", Name, pLevel, pVipRank, pAdminLevel);
if(pVipRank) {    // If pVipRank = 1
format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: YES | Admin Level: %d |", Name, pLevel, pVipRank, pAdminLevel);
}
SendClientMessage(playerid, COLOR_ONLOGIN, string);
I hope this helps, thou i'm 99.9% sure that this works, i appriciate if you reply if it helped or not. Thanks
Reply
#5


That's what I'm talking about!
Thanks mate
Reply
#6

There is better way to do this...

pawn Код:
new
pVipRank = Player[playerid][VipRank],
pAdminLevel = Player[playerid][AdminLevel],
Player[playerid][Level],
textvip[10];
if(Player[playerid][VipRank] < 1) { textvip = "No"; }
else if(Player[playerid][VipRank] >= 1) { textvip = "Yes"; }
format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: %s | Admin Level: %d |", Name, pLevel, textvip, pAdminLevel);
SendClientMessage(playerid, COLOR_ONLOGIN, string);
Reply
#7

Yes, that's even easier.
But everyone can do this be another way.
Reply
#8

easiest way would be this:

pawn Код:
format(string, sizeof(string),"| You have soccessfully logged in as %s | Level: %d | VIP: %s | Admin Level: %d |", Name, pLevel, pVipRank ? ("Yes") : ("No"), pAdminLevel);
SendClientMessage(playerid, COLOR_ONLOGIN, string); //fixed now ;)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)