14.10.2010, 21:02
I made that script, again trying to make it work but IT DOESN'T .
I made a /frisk command but It doesn't work well, It shows the result like this it writes Empty more then 5 times, even though I wrote only once.
Can any one help me fixing the code, so that it won't show 8 messages of "1. Empty" and then 8 messages of "1.Empty" and one with the gun.
I made a /frisk command but It doesn't work well, It shows the result like this it writes Empty more then 5 times, even though I wrote only once.
Can any one help me fixing the code, so that it won't show 8 messages of "1. Empty" and then 8 messages of "1.Empty" and one with the gun.
pawn Код:
if(strcmp(cmd, "/checkweapon", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized");
return 1;
}
tmp = strtok(cmdtext,idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /checkweapon [playerid/partOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (giveplayerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GREY, "That player is offline");
return 1;
}
new sweapon, sammo;
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%s has the following weapons:", giveplayer);
SendClientMessage(playerid, COLOR_GRAD1, string);
for (new i=0; i<9; i++)
{
GetPlayerWeaponData(giveplayerid, i, sweapon, sammo);
if(sweapon != 0)
{
format(string, sizeof(string), "%d: %d (%d)", i, sweapon, sammo);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "1. Empty");
}
}
return 1;
}