Quote:
Originally Posted by mamorunl
At the moment (I assume you are talking about the second paragraph) you use an integer. You can do it simply and map that integer to a string (or actually just the other way around):
pawn Код:
CMD:bla(playerid, params[]) { sscanf(params, "is[128]", id, rank); if(!strcmp(rank, "Bronze")) { // Set the rank to int 0 } // do the same for silver and gold else { // Not bronze, not silver, not gold so false.. deliver an error } }
In your showing command you can then use it like this:
pawn Код:
CMD:getvip(playerid, params[]) { switch(vipid) { case 0: // no lvl case 1: SendClientMessage(playerid, 0xFFFFFF00, "Bronze"); case 2: SCM("silver"); // shortened above case 3: SCM("Gold"); default: "Error" } }
And the rest can stay the same
|
Umm, I just want to do /changeviplevel [id] [gold/silver/bronze]
So when a player does /stats it shows VIP: Gold.
This is the current /changeviplevel command:
pawn Код:
command(changeviplevel, playerid, params[])
{
new level, id, string[128];
if(sscanf(params, "ud", id, level))
{
if(Player[playerid][AdminLevel] >= 1)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /changeviplevel [playerid] [level]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 5)
{
if(IsPlayerConnectedEx(id))
{
Player[id][VipRank] = level;
format(string, sizeof(string), "%s's VIP level has been changed to %d, by %s.", GetName(id), level, GetName(playerid));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][VipRank] >= 1)
{
SendClientMessage(i, YELLOW, string);
}
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
}
return 1;
}
And in stats:
pawn Код:
format(string, sizeof(string), "Name: %s | Admin Level: %d | Last IP: %s | Last Login: %d/%d/%d | Time: %d:%d | Status: Unbanned.", Name, dini_Int(string2, "AdminLevel"), dini_Get(string2, "LastIP"), dini_Int(string2, "LastLoginDay"), dini_Int(string2, "LastLoginMonth"), dini_Int(string2, "LastLoginYear"), dini_Int(string2, "LastLoginHour"), dini_Int(string2, "LastLoginMinute"));
SendClientMessage(playerid, GREY, string);
format(string, sizeof(string), "Geographical Location: %s | Playing Hours: %d | Materials: %d | House: %d | Business: %d", GetIPCountry(dini_Get(string2, "LastIP")) , dini_Int(string2, "PlayingHours"), dini_Int(string2, "Materials"), dini_Int(string2, "House"), dini_Int(string2, "Business"));
SendClientMessage(playerid, GREY, string);
format(string, sizeof(string), "Cocaine: %d grams | Pot: %d grams | Group: %d (%s)", dini_Int(string2, "Crack"), dini_Int(string2, "Pot"), dini_Int(string2, "Group"), Groups[dini_Int(string2, "Group")][GroupName]);
SendClientMessage(playerid, GREY, string);
How would I be able to show the vip level in with those lines.