Need help with this comman.
#1

I have this command /checkg which shows you a player's weapons if he has one.
This is the command.
Код:
CMD:checkg(playerid, params[])
{
	if(playerVariables[playerid][pAdminLevel] > 0)
	{
		new id, weapons[13][2], string[256], count;
		if(sscanf(params, "r", id)) return SendClientMessage(playerid, COLOR_GRAD2, "Usage: {FFFFFF}/checkg [playerid]");
		SCM(playerid, -1, "----- Weapon Data -----");
		for (new i = 0; i < 13; i++)
		{
			GetPlayerWeaponData(id, i, weapons[i][0], weapons[i][1]);
			if(weapons[i][0] > 0)
			{
				format(string, sizeof(string), "(%d) %s - %d", i, WeaponNames[weapons[i][0]], weapons[i][1]);
				SCM(playerid, COLOR_ORANGERED, string);
				count++;
			}
		}
		if(count == 0)
		{
			SCM(playerid, COLOR_ORANGERED, "* No data available.");
		}
		SCM(playerid, -1, "-------------------");
	}
	else return SendClientMessage(playerid, -1, AdminOnly);
	return 1;
}
Now it works just fine, but I don't want it to show the messages under each other.
So let's say that the player has a deagle in his first slot and an m4 in his second slots.
This command should display this.
Код:
/checkg: Deagle (30 bullets), M4 (40 bullets)
So instead of under each other, next to each other.
Reply
#2

pawn Код:
CMD:checkg(playerid, params[])
{
    if(playerVariables[playerid][pAdminLevel] > 0)
    {
        new id, weapons[13][2], string[256], count;
                new weapstring[256] = "Weapons: ",
        if(sscanf(params, "r", id)) return SendClientMessage(playerid, COLOR_GRAD2, "Usage: {FFFFFF}/checkg [playerid]");
        SCM(playerid, -1, "----- Weapon Data -----");
        for (new i = 0; i < 13; i++)
        {
            GetPlayerWeaponData(id, i, weapons[i][0], weapons[i][1]);
            if(weapons[i][0] > 0)
            {
                                strins(weapstring,", ",strlen(weapstring));
                format(string, sizeof(string), "(%d) %s - %d", i, WeaponNames[weapons[i][0]], weapons[i][1]);
                                strins(weapstring,string,strlen(weapstring));
                count++;
            }
        }
        if(count == 0)
        {
            SCM(playerid, COLOR_ORANGERED, "* No data available.");
        }
                else
                {
                        SCM(playerid, COLOR_ORANGERED, weapstring);
                }
        SCM(playerid, -1, "-------------------");
    }
    else return SendClientMessage(playerid, -1, AdminOnly);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)