25.10.2013, 14:23
Okay I'm converting command /frisk from ZCMD to Strcmp.. don't ask why 
So this command shows my weapons and so on..
But the problem is if I write /frisk (ANY ID) it will frisk me :/ it doesn't want to send me error message "Invalid player ID" what is wrong? :/

So this command shows my weapons and so on..
But the problem is if I write /frisk (ANY ID) it will frisk me :/ it doesn't want to send me error message "Invalid player ID" what is wrong? :/
pawn Код:
if(strcmp(cmd,"/frisk",true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /frisk[playerid/PartOfName]");
return 1;
}
if (id == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid player ID!");
return 1;
}
if (IsPlayerInAnyVehicle(id))
{
SendClientMessage(playerid, COLOR_WHITE, "This player is in vehicle!");
return 1;
}
if (!IsPlayerInRangeOfPoint(id, 5.0, x, y, z))
{
SendClientMessage(playerid, COLOR_WHITE, "This player is to far away");
return 1;
}
// if is player connected...
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)
{
SendClientMessage(playerid,0x33AA33AA,"No weapons found!");
return 1;
}
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;
}
return 0;
}