SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/10/2019, 07:10 PM   #1
Hazon
Big Clucker
 
Hazon's Avatar
 
Join Date: May 2018
Location: Who cares ?
Posts: 139
Reputation: 18
Default Button.

Hi,

How to make that if player hold button (any) gametext will count 5..4...3...2 and if the player release a key a count will stop.
Hazon is offline   Reply With Quote
Old 13/10/2019, 07:14 PM   #2
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 322
Reputation: 12
Default Re: Button.

From the wiki page, https://wiki.sa-mp.com/wiki/OnPlayerKeyStateChange

You'll need to do something like:
Code:
// HOLDING(keys)
#define HOLDING(%0) \
	((newkeys & (%0)) == (%0))
Code:
if (HOLDING( KEY_CROUCH )) // c or space depending on playerstate
Then to detect when they stop holding the key:
Code:
if (RELEASED( KEY_CROUCH ))
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button Micko123 Scripting Help 7 03/05/2016 02:59 PM
How To Add Button? XaibBaba Scripting Help 6 22/08/2014 06:19 AM
One Button Er@x3r Scripting Help 2 03/10/2012 05:24 PM
NEXT button help johnnyyy Scripting Help 3 12/11/2011 05:13 AM
Key 2 button RBTDM Scripting Help 3 11/09/2011 01:33 PM


All times are GMT. The time now is 07:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.