Gate moving problem
#1

Well, everything is working perfectly with my script, exept one thing:
It is supposed to only open if the player is in a certain distance, that is supposed to be 1 meter from the gate, but no matter how far/close I am, if I press "Space" or "W" it opens up...

Here goes the code:

PHP код:
#define FILTERSCRIPT
#include <a_samp>
new Gate;
forward gate(playerid);
#define PRESSED(%0) \
      
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public 
OnGameModeInit()
{
    
Gate CreateObject(980,-302.3114,1511.1448,76.6647,0.0000,0.0000,1.3273600);
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
IsPlayerInRangeOfPoint(playerid1.0, -302.98521511.144874.3579)) return 1;
    {
       if(
PRESSED(KEY_SPRINT))//Gate open
       
{
           
MoveObject(Gate, -313.84031510.869476.66472.50);
           
SetTimerEx("gate"5000false"i"playerid);
       }
    }
    return 
1;
}
public 
gate(playerid)
{
   
MoveObject(Gate,-302.3114,1511.1448,76.6647,2.50);
   return 
1;

Reply
#2

Код:
if(IsPlayerInRangeOfPoint(playerid, 1.0, -302.9852, 1511.1448, 74.3579))
remove return 1;
it's not needed everywhere
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)