You are definitely standing beside the player right?
I just threw the CMD into my script to test it and it worked like this;
pawn Код:
CMD:frisk(playerid, params[])
{
if (!IsCop[playerid]) return SendClientMessage(playerid, 0xFF0000AA, "You are not authorized to use this command");
new
id,
Slot,
Weapon,
Ammo,
CNT,
X,
Str[128],
Str2[64],
WN[32],
Float:x,
Float:y,
Float:z,
Name[MAX_PLAYER_NAME];
if (sscanf(params, "u", id)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: \"/frisk [playerid]\"");
GetPlayerName(id, Name, sizeof(Name));
GetPlayerPos(id, x, y, z); // Your position
printf("XIS:%f YIS:%f ZIS:%f", x,y,z);
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Invalid player ID");
else if (IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, 0xFF0000AA, "That player is in vehicle");
else if (!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) return SendClientMessage(playerid, 0xFF0000AA, "You are not near that player");
else if (id == playerid) return SendClientMessage(playerid, 0xFF0000AA,"You can't frisk yourself");
else
{
format(Str2, sizeof(Str2), "__________%s's Weapon Information___________", Name);
SendClientMessage(playerid, COLOR_YELLOW, Str2);
for(Slot = 0; Slot < 14; Slot++)
{
GetPlayerWeaponData(id, Slot, Weapon, Ammo);
if( Ammo != 0 && Weapon != 0)
CNT++;
}
if(CNT < 1) return SendClientMessage(playerid,0x33AA33AA,"No weapons found!");
if(CNT >= 1)
{
for (Slot = 0; Slot < 14; Slot++)
{
GetPlayerWeaponData(id, Slot, Weapon, Ammo);
if( Ammo != 0 && Weapon != 0)
{
GetWeaponName(Weapon,WN, sizeof(WN));
if(Ammo == 65535 || Ammo == 1)
format(Str,sizeof(Str),"%s%s (1)",Str, WN);
else format(Str,sizeof(Str),"%s%s (%d)",Str, WN, Ammo);
X++;
if(X >= 5)
{
SendClientMessage(playerid, 0x33AA33AA, Str);
X = 0;
format(Str, sizeof(Str), "");
}
else format(Str, sizeof(Str), "%s, ", Str);
}
}
if(X <= 4 && X > 0)
{
Str[strlen(Str)-3] = '.';
SendClientMessage(playerid, 0x33AA33AA, Str);
}
}
}
return 1;
}
Stand right beside the player and test it. Also; remove
pawn Код:
printf("XIS:%f YIS:%f ZIS:%f", x,y,z);
if you want; i just used it to debug.
Incase you don't know; the 5.0 in this line;
pawn Код:
(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
is the distance from you to point of x,y,z.