Problem - 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)
+--- Thread: Problem (
/showthread.php?tid=291759)
Problem -
Shelton Culmer - 21.10.2011
Hello there everyonie i am trying to make onplayerstatchange i made one where i an press sprint so i can enter a building but now when i go in build i made a next code to make me exit the building but it wont work please help here the code
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((oldkeys & KEY_SPRINT) && !(newkeys & KEY_SPRINT))
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1553.7203,-1675.6603,16.1953)) //replace with the position where to press the alt button
{
SetPlayerInterior(playerid, 10);
SetPlayerPos(playerid, 246.40,110.84,1003.22);
}
return 1;
}
if ((oldkeys & KEY_SPRINT) && !(newkeys & KEY_SPRINT))
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 245.6786,107.3357,1003.2188)) //replace with the position where to press the alt button
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1553.7203,-1675.6603,16.1953);
}
return 1;
}
return 0;
}
please help fix it
Re: Problem -
MP2 - 21.10.2011
2.0 radius is tiny, you likely aren't standing so close to the point. I'd increase it to at least 5 or 10. 2 is about the radius of a car wheel.
Re: Problem -
Shelton Culmer - 21.10.2011
can you write it out your self i tried no diferent
Re: Problem -
[MWR]Blood - 21.10.2011
Replace
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, 245.6786,107.3357,1003.2188))
with
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 7.5, 245.6786,107.3357,1003.2188))
...
Re: Problem -
Shelton Culmer - 21.10.2011
Omg man ur so awesome thanks
Re: Problem -
SmiT - 21.10.2011
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ( newkeys & KEY_SPRINT )
{
if( IsPlayerInRangeOfPoint( playerid, 7.5, 1553.7203,-1675.6603,16.1953 ) )
{
SetPlayerInterior( playerid, 10 );
SetPlayerPos( playerid, 246.40,110.84,1003.22 );
}
else if( IsPlayerInRangeOfPoint( playerid, 7.5, 245.6786,107.3357,1003.2188 ) )
{
SetPlayerInterior( playerid, 0 );
SetPlayerPos( playerid, 1553.7203,-1675.6603,16.1953 );
}
return true;
}
return false;
}
Re: Problem -
Shelton Culmer - 21.10.2011
Thank you so much