/wcheck - 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: /wcheck (
/showthread.php?tid=88338)
/wcheck -
Agent Smith - 25.07.2009
Yo guys, I go this /wcheck so that admins can know what weapons they have and how much ammo they have on them but the problem is it only says the Weapon ID, so the admin has to look at the weapon IDs to see what gun they have. Can you please help me change the command so that it says the name of the gun as well.
Код:
if(strcmp(cmd, "/wcheck", 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] /wcheck [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;
new giveplayer[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%s has the following weapons:", giveplayer);
SendClientMessage(playerid, COLOR_YELLOW, 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_GREY, string);
}
}
return 1;
}
Re: /wcheck -
MadeMan - 25.07.2009
https://sampwiki.blast.hk/wiki/GetWeaponName
Re: /wcheck -
Jefff - 25.07.2009
Код:
if(strcmp(cmd, "/wcheck", 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] /wcheck [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, wname[32];
new giveplayer[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "%s has the following weapons:", giveplayer);
SendClientMessage(playerid, COLOR_YELLOW, string);
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(giveplayerid, i, sweapon, sammo);
GetWeaponName(sweapon, wname,32);
if(sweapon != 0)
{
format(string, sizeof(string), "Slot: %d, WName: %s, WID: %d, Ammo: (%d)", i, wname, sweapon, sammo);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
return 1;
}
Re: /wcheck -
Agent Smith - 25.07.2009
Thanks alot guys :P