SA-MP Forums Archive
Command bug (/weapons) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command bug (/weapons) (/showthread.php?tid=238456)



Command bug (/weapons) - Unknown123 - 11.03.2011

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"


Re: Command bug (/weapons) - willsuckformoney - 11.03.2011

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;
    }
}