Need help with this comman. - 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)
+--- Thread: Need help with this comman. (
/showthread.php?tid=604865)
Need help with this comman. -
danielpalade - 10.04.2016
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.
Re: Need help with this comman. - Jelly23 - 10.04.2016
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;
}