Quick Question.
#3

I tested this with debug messages and it worked for me.

PHP код:
CMD:rape(playeridparams[])
{
    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:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    foreach (new 
Player)
    {
        if (
IsPlayerInRangeOfPoint(i5.0xyz))
        {
            return 
i;
        }
    }
    return 
INVALID_PLAYER_ID;

Btw, I don't think you really need to calculate the coordinates to get the nearest id.
Reply


Messages In This Thread
Quick Question. - by Ritzy2K - 03.05.2016, 14:20
Re: Quick Question. - by ReD_HunTeR - 03.05.2016, 14:55
Re: Quick Question. - by Sjn - 03.05.2016, 14:56
Re: Quick Question. - by Ritzy2K - 03.05.2016, 15:00
Re: Quick Question. - by xTURBOx - 03.05.2016, 15:55
Re: Quick Question. - by Ritzy2K - 03.05.2016, 17:01
Re: Quick Question. - by jlalt - 03.05.2016, 19:32
Re: Quick Question. - by Ritzy2K - 03.05.2016, 19:41
Re: Quick Question. - by jlalt - 03.05.2016, 19:52

Forum Jump:


Users browsing this thread: 1 Guest(s)