Quick Question.
#1

Hello, I wana make a /rape command, In that i want that If player does /rape, it infects the closest player, but if player does /rape [id] it infects that specified player only.

How do i do that.

I have done this yet -

Код:
/*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.");

	if  (sscanf(params, "u", rapedid))
	    return SendSyntaxMessage(playerid, "/rape (playerid / Name).");
*/
I've only coded till this because i got stuck in this issue.
and this my stock to get the closest player

Код:
stock GetNearestPlayerInView(playerid, Float:distance = 2.0)
{
	new
	    Float:fAngle,
		Float:fPosX,
		Float:fPosY,
		Float:fPosZ;

	GetPlayerFacingAngle(playerid, fAngle);
	GetPlayerPos(playerid, fPosX, fPosY, fPosZ);

	fPosX += distance * floatsin(-fAngle, degrees);
	fPosY += distance * floatcos(-fAngle, degrees);

	foreach (new i : Player) if (IsPlayerInRangeOfPoint(i, 5.0, fPosX, fPosY, fPosZ)) {
	    return i;
	}
	return INVALID_PLAYER_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)