enter key doesn't work ..
#1

So i tried to make entrances with [Enter] key , but it's just doesn't work .


Here is my whole OnPlayerKeyStateChange callback .


Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(GetPVarInt(playerid, "Injured") != 0) return 0;
        if(!gPlayerUsingLoopingAnim[playerid]) return 0;
        if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys))
        {
            StopLoopingAnim(playerid);
            TextDrawHideForPlayer(playerid,txtAnimHelper);
            return 1;
        }

        if((newkeys & KEY_JUMP) && !IsPlayerInAnyVehicle(playerid))
        {
            bunnyhop1[playerid] ++;
            SetTimerEx("bunnyhop3", 14000, false, "i", playerid);
            if(bunnyhop1[playerid] == 2)
            {
                    ApplyAnimation(playerid, "PED", "BIKE_fall_off", 4.1, 0, 1, 1, 1, 0, 1);
                    SetTimerEx("bunnyhop2", 5000, false, "i", playerid);
                    return 1;
            }
        }
        
        //entrances
        if (newkeys & KEY_SECONDARY_ATTACK)
        {
            
            if(PlayerToPoint(2,playerid,137.1711,1446.1860,11.1372))
            {
                SetPlayerPos(playerid,1809.8553,-1548.7037,5700.4287);
                return 1;
            }
            if(PlayerToPoint(2,playerid,1809.8553,-1548.7037,5700.4287))
            {
                SetPlayerPos(playerid,137.1711,1446.1860,11.1372);
                return 1;
            }
            
            if(PlayerToPoint(2,playerid,200.2337,1400.4672,10.5859))
            {
                SetPlayerPos(playerid,772.1120,-3.8986,1000.7288);
                SetPlayerInterior(playerid, 5);
                return 1;
            }
            if(PlayerToPoint(2,playerid,772.1120,-3.8986,1000.7288))
            {
                SetPlayerPos(playerid,200.2337,1400.4672,10.5859);
                SetPlayerInterior(playerid, 0);
                return 1;
            }
            
            if(PlayerToPoint(2,playerid,207.1110,1347.5542,10.5859))
            {
                SetPlayerPos(playerid,246.06038, 1386.54834, -15.22439);
                return 1;
            }
            if(PlayerToPoint(2,playerid,246.06038, 1386.54834, -15.22439))
            {
                SetPlayerPos(playerid,207.1110,1347.5542,10.5859);
                SetPlayerInterior(playerid, 0);
                return 1;
            }
        }
        return 1; 
}
Reply
#2

Anyone ?
Reply
#3

Please share this: PlayerToPoint
Reply
#4

PlayerToPoint

Код:
public 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
#5

Why not use IsPlayerInRangeOfPoint?
Reply
#6

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Why not use IsPlayerInRangeOfPoint?
i found my old gamemode , just adding a couple of things . But those annoying entrances don't work .
Reply
#7

Simply use samp's range checker: IsPlayerInRangeOfPoint(..)
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#8

Fixed .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)