16.03.2013, 20:34
Hey, I'm currently developing the factions part of a script i'm making and have encountered a problem. First of all i'm loading the rank names from the MySQL table and they're loading fine, then I have a variable for every player's faction rank which is an integer, I've also made a stock function to convert it form an integer to a string but it doesn't actually work, i've got a command which is /showbadge to show a players faction badge to another player.
As you can see, i've got the stock to convert it but nothing actually shows when I type the command which is odd.
Код:
/* COMMANDS */ CMD:showbadge(playerid, params[]) { new tarID, String[256]; if(sscanf(params, "i", tarID)) SendUsageMessage(playerid, "/showbadge [targetid]"); if(!IsPlayerConnected(tarID)) return SendClientMessage(playerid, COLOR_GREY, "Target isn't connected."); else { format(String, sizeof String, "[%s - %s]", GetName(playerid), FactionInfo[PlayerInfo[playerid][pFaction]][fName]); SendClientMessage(tarID, COLOR_YELLOW, String); format(String, sizeof String, "Rank: %s(%d)", GetRankName(playerid), PlayerInfo[playerid][pFacRank]); SendClientMessage(tarID, COLOR_YELLOW, String); } return 1; } /* Get Rank Names */ stock GetRankName(playerid) { new String[128]; switch(PlayerInfo[playerid][pFacRank]) { case 0: format(String, sizeof String, "N/A"); case 1: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank1]); case 2: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank2]); case 3: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank3]); case 4: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank4]); case 5: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank5]); case 6: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank6]); case 7: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank7]); case 8: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank8]); case 9: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank9]); case 10: format(String, sizeof String, "%s", FactionInfo[PlayerInfo[playerid][pFaction]][fRank10]); } return String; }