Command bug (/weapons)
#1

Code:
pawn Код:
dcmd_weapons(playerid, params[])
{
    #pragma unused params
    if(gTeam[playerid] == TEAM_WEAPON_DEALER) return SendClientMessage(playerid, COLOR_ERROR, "You is an bistro, You cant call for other weapon dealers");
    else if(HasRequestedWeaponDealer[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "You have already requested a weapon dealer, please sit down and wait");
    else
    {
        SendClientMessage(playerid, COLOR_GREEN, "You have requested a weapon dealer"); //Message to the player who have requesed weapon dealer
        WeaponList(playerid);
        HasRequestedWeaponDealer[playerid] = 1;

        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(gTeam[i] == TEAM_WEAPON_DEALER)
            {
                new string[128];
                format(string, sizeof(string), "%s(%d) has requested a weapon dealer in %s", PlayerName(i), i, GetPlayerZone(i)); //Send the message to online Weapon Dealers
                SendClientMessage(i, COLOR_GREEN, string);
                ServerLog(string);
                return 1;
            }
        }
        return 1;
    }
}
Function(s):
Код:
stock PlayerName(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	return name;
}
Bug:
i = Unknown123... ID 1 (Not weapon dealer)
he = Raphael... ID 0 (Waepon Dealer)

When i type /weapons then i get the message "You have requested...." (..Nothing wrong there)
But for the weapons dealer get "Raphael(1) has requested a weapon dealer in San Fierro"

But it should be "Unknown123(1) has requested a weapon dealer in San Fierro"
Reply
#2

Try that.

pawn Код:
dcmd_weapons(playerid, params[])
{
    #pragma unused params
    if(gTeam[playerid] == TEAM_WEAPON_DEALER) return SendClientMessage(playerid, COLOR_ERROR, "You is an bistro, You cant call for other weapon dealers");
    else if(HasRequestedWeaponDealer[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "You have already requested a weapon dealer, please sit down and wait");
    else
    {
        SendClientMessage(playerid, COLOR_GREEN, "You have requested a weapon dealer"); //Message to the player who have requesed weapon dealer
        WeaponList(playerid);
        HasRequestedWeaponDealer[playerid] = 1;

        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(gTeam[i] == TEAM_WEAPON_DEALER)
            {
                new string[128];
                format(string, sizeof(string), "%s(%d) has requested a weapon dealer in %s", PlayerName(playerid), i, GetPlayerZone(i)); //Send the message to online Weapon Dealers
                SendClientMessage(i, COLOR_GREEN, string);
                ServerLog(string);
                return 1;
            }
        }
        return 1;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)