SA-MP Forums Archive
Horn Key - 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: Horn Key (/showthread.php?tid=191732)



Horn Key - [UG]Scripter - 20.11.2010

Hey,

Bey I'm trying to make it so when a cop press's the Horn key in a cop car A text draw will appear and say Emergency lights activated, The only Problem I have is that I dont know what the Key_ is for Horn and how to detect if its a cop car. The team and that I can do but yeah.

Any help is appreciated.


Re: Horn Key - ColdXX - 20.11.2010

its KEY_CROUCH


Re: Horn Key - JaTochNietDan - 20.11.2010

There is no default define for a KEY_HORN id.

You can easily find the ID of the key yourself by making a simple system to print the ID of the keys when they are pressed in-game.

pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    printf("Newkeys: %d",newkeys);
    return 1;
}
Go in-game, make sure you're not pressing any buttons, then press the horn button, let go it, then look at your console or server_log.txt, and you will see the ID of the horn button printed in there.


Re: Horn Key - ColdXX - 20.11.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
There is no default define for a KEY_HORN id.

You can easily find the ID of the key yourself by making a simple system to print the ID of the keys when they are pressed in-game.

pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    printf("Newkeys: %d",newkeys);
    return 1;
}
Go in-game, make sure you're not pressing any buttons, then press the horn button, let go it, then look at your console or server_log.txt, and you will see the ID of the horn button printed in there.
But cant KEY_CROUCH be used for Horn, cuz im using that.


Re: Horn Key - iRana - 20.11.2010

KEY_CROUCH is horn key , but if player is on foot it means key 'C'....


Re: Horn Key - JaTochNietDan - 20.11.2010

Quote:
Originally Posted by ColdXX
Посмотреть сообщение
But cant KEY_CROUCH be used for Horn, cuz im using that.
Well sure if it has the same ID, although this method will find any key you want to use, if it is not in the definitions.


Re: Horn Key - [UG]Scripter - 20.11.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well sure if it has the same ID, although this method will find any key you want to use, if it is not in the definitions.
Hey, Thanks for that


Re: Horn Key - TheXIII - 20.11.2010

Just pointing out that there is no dependable way to detect the sirens, I think. At least this is not.
What if player holds the horn key for a bit longer, instead of just pressing it for a moment?