SA-MP Forums Archive
Problem 2 - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem 2 (/showthread.php?tid=114799)



Problem 2 - eXtr1kE - 20.12.2009

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?



Re: Problem 2 - Kurence - 20.12.2009

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


Re: Problem 2 - Marcel - 20.12.2009

Put the code in OnPlayerKeyStateChange.


Re: Problem 2 - eXtr1kE - 20.12.2009

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


Re: Problem 2 - Marcel - 20.12.2009

Put the code you had first in OnPlayerKeyStateChange.


Re: Problem 2 - eXtr1kE - 21.12.2009

Well, I had no OnPlayerKeyStateChange in GM or in FS.


Re: Problem 2 - Deat_Itself - 21.12.2009

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: Problem 2 - eXtr1kE - 21.12.2009

Rezolved