Problem 2
#1

so I script this :

Код:
#include <a_samp>
#include <a_vehicles>
#include <a_players>
#include <k_functions>

#pragma tabsize 0
new lspdgate;
forward lspdgateclose();


public OnPlayerCommandText(playerid, cmdtext[])

if ((newkeys==KEY_CROUCH )&&(IsPlayerInCopCar(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
  {
  GetPlayerSkin(playerid);

if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164) || IsPlayerSkin(playerid, 165) || IsPlayerSkin(playerid, 166) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287))

  {
  MoveObject(lspdgate, 1597.288696, -1637.887085, 14.706839, 4.0);
  SendClientMessage(playerid, 0xAAAAAAAA, "GATE OFFICER: Gate opened.");
  SetTimer("lspdgateclose",3000, false);

}
else
{
SendClientMessage(playerid, 0xAAAAAAAA,"GATE OFFICER: You have to be a cop to open this gate");
}
}

public lspdgateclose()
{
MoveObject(lspdgate, 1588.416260, -1637.907715, 14.705267, 3.0);
}
how can I do to open the gate when the horn instead write the order?
Reply
#2

You want to make the gate open without horn? Try to use function IsPlayerInRangeOfPoint and timer what is checking it.
Reply
#3

Put the code in OnPlayerKeyStateChange.
Reply
#4

Sorry

Код:
#include <a_samp>
#include <a_vehicles>
#include <a_players>
#include <k_functions>

#pragma tabsize 0
new lspdgate;
forward lspdgateclose();


public OnPlayerCommandText(playerid, cmdtext[])

if( !strcmp(cmdtext, "/opengate", true) )
  {
  GetPlayerSkin(playerid);

if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164) || IsPlayerSkin(playerid, 165) || IsPlayerSkin(playerid, 166) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287))

  {
  MoveObject(lspdgate, 1597.288696, -1637.887085, 14.706839, 4.0);
  SendClientMessage(playerid, 0xAAAAAAAA, "GATE OFFICER: Gate opened.");
  SetTimer("lspdgateclose",3000, false);

}
else
{
SendClientMessage(playerid, 0xAAAAAAAA,"GATE OFFICER: You have to be a cop to open this gate");
}
}

public lspdgateclose()
{
MoveObject(lspdgate, 1588.416260, -1637.907715, 14.705267, 3.0);
}
... /opengate is command
Help me please
Reply
#5

Put the code you had first in OnPlayerKeyStateChange.
Reply
#6

Well, I had no OnPlayerKeyStateChange in GM or in FS.
Reply
#7

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#8

Rezolved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)