enter key doesn't work .. -
Lukasz56 - 30.01.2015
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;
}
Re: enter key doesn't work .. -
Lukasz56 - 30.01.2015
Anyone ?
Re: enter key doesn't work .. -
Gammix - 30.01.2015
Please share this: PlayerToPoint
Re: enter key doesn't work .. -
Lukasz56 - 30.01.2015
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;
}
Re: enter key doesn't work .. -
CalvinC - 30.01.2015
Why not use IsPlayerInRangeOfPoint?
Re: enter key doesn't work .. -
Lukasz56 - 30.01.2015
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 .
Re: enter key doesn't work .. -
Gammix - 30.01.2015
Simply use samp's range checker: IsPlayerInRangeOfPoint(..)
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Re: enter key doesn't work .. -
Lukasz56 - 30.01.2015
Fixed .