PHP код:
CMD:checkweapons(playerid,params[])
{
new temp[100], idx, targetid, string[256];
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_ERROR, "You are not authorized");
return 1;
}
temp = strtok(params,idx);
if (!strlen(temp))
{
SendClientMessage(playerid, COLOR_WHITE, "Synthax: /checkweapons <playerid/partOfName>");
return 1;
}
targetid = ReturnUser(temp);
if (targetid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_ERROR, "That player is offline");
return 1;
}
new weaponsmodel, ammunition;
new playername[MAX_PLAYER_NAME];
GetPlayerName(targetid, playername, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s has the following weapons:", playername);
for (new i=0; i<9; i++)
{
GetPlayerWeaponData(targetid, i, weaponsmodel, ammunition);
if(weaponsmodel != 0)
{
format(string, sizeof(string), "%d: %d (%d)", i, weaponsmodel, ammunition);
SendClientMessage(playerid, COLOR_ADMIN_INFO, string);
}
}
}
return 1;
}