command help
#1

hello,i got one cmd,and i want to make it like i can use it only if im at some coordinates,
338.4752,-2416.0164,14.2604
thanks
Reply
#2

Код:
dcmd_shpos(playerid, params[])
{
	new string[128];
	new Float:x, Float:y, Float:z, Float:a;
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid,a);
	format(string, sizeof(string), "X=%f  Y=%f  Z=%f  A=%f",x,y,z,a);
	SendClientMessage(playerid, COLOR_RED, string);
	#pragma unused params
	return 1;
}
Reply
#3

where do i add coordinates and where i add those lines?
Reply
#4

You can use PlayerToPoint

pawn Код:
if(PlayerToPoint(1.0, playerid, 338.4752,-2416.0164,14.2604))
You need this somewhere in your script:

pawn Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)