SA-MP Forums Archive
Help With Key - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help With Key (/showthread.php?tid=267445)



Help With Key - [MKD]Max - 08.07.2011

what is worng why its not work i try to ways its under

1.
Код:
p
ublic OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	if(PRESSED(KEY_SECONDARY_ATTACK))
	{

	if(X >= 1019.6192 && X <= 1047.1677 && Y >= -2321.0471 && Y <= -2347.2522)
             {
		SendClientMessage(playerid,COLOR_GREEN,"Lift is Going Up");
		MoveObject(lift,1024.61, -2345.58, 12.60,3);
	}
	}
	return 1;
}
2.
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid,X,Y,Z);
	if(X >= 1019.6192 && X <= 1047.1677 && Y >= -2321.0471 && Y <= -2347.2522)
	{
	if(PRESSED(KEY_SECONDARY_ATTACK))
	{
		SendClientMessage(playerid,COLOR_GREEN,"Lift is Going Up");
		MoveObject(lift,1024.61, -2345.58, 12.60,3);
	}
	}
	return 1;
}



Re: Help With Key - Rolyy - 08.07.2011

Why using? if(X >= 1019.6192 && X <= 1047.1677 && Y >= -2321.0471 && Y <= -2347.2522)

Try using https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 20.0, 1019.6192 , 1047.1677 , 0.0000))
    {
        SendClientMessage(playerid,COLOR_GREEN,"Lift is Going Up");
        MoveObject(lift, 1024.61, -2345.58, 12.60,3);
    }