03.05.2016, 14:56 
	
	
	
		I tested this with debug messages and it worked for me.
Btw, I don't think you really need to calculate the coordinates to get the nearest id.
	
	
	
	
PHP код:
CMD:rape(playerid, params[])
{
    new rapedid;
    if  (!IsPlayerSpawned(playerid) || PlayerData[playerid][pJailTime] > 0)
        return SendErrorMessage(playerid, "You Cannot Use This Command Right Now");
    if    (PlayerData[playerid][pOnDuty])
        return SendErrorMessage(playerid, "You Cannot Use This Command Whilst On-Duty.");
    new closest = GetNearestPlayerInView(playerid);
    if  (sscanf(params, "u", rapedid))
        rapedid = closest;
    else
        rapedid = strval(params);
    if(rapedid == closest)
    {
        // Rape the closest player
         //SendClientMessage(playerid, -1, "You can also use /rape <id>");
    }
    else
    {
        // Rape the specified player
    }
    return 1;
}
stock GetNearestPlayerInView(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    foreach (new i : Player)
    {
        if (IsPlayerInRangeOfPoint(i, 5.0, x, y, z))
        {
            return i;
        }
    }
    return INVALID_PLAYER_ID;
} 


