23.12.2017, 14:20
How to press key as in this video https://www.youtube.com/watch?time_c...&v=jtwl1ZATR6c
Look, this can be done, Set it as a minigame go check my minigame tutorial to know the basic concept, put the players in the cars and lock them in or do if a player exits car = lose and exit, then you can check it through OnPlayerKeyStateChange, give players instructions on-screen with textdraws or gametexts then detect those instructions through OnPlayerKeyStateChange and give them points every time they press the right key at the right time, how to do that? new KeysPressed[MAX_PLAYERS]; then say for ex, you want the order to be up up down right left left up , okay? check SAMP KEYS to know the keys then for ex at OnPlayerKeyStateChange check for all of the keys, up down left and right (analog) then do if KeysPressed[playerid] ==0 this is the first key pressed if you want it up then put that under up and do KeysPressed[playerid]++; then apply this concept for all keys and the player who hits the score you want( hitting the last key) wins, this is very possible.
PS: don't forget to turn the car's engine off and force it off until the minigame ends so that they can only move the car but not change its xyz pos. EDIT: i'm interested in this, if i ever make this minigame/event i will release it and mention you. |
new KeyPressed[MAX_PLAYERS];
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_ANALOG_RIGHT))
{
if(KeyPressed[playerid] ==0)
{
KeyPressed[playerid]++;
}
}
else if(PRESSED(KEY_ANALOG_DOWN))
{
if(KeyPressed[playerid] ==1)
{
KeyPressed[playerid]++;
}
}
else if(PRESSED(KEY_ANALOG_LEFT))
{
if(KeyPressed[playerid] ==2)
{
KeyPressed[playerid]++;
}
}
else if(PRESSED(KEY_ANALOG_UP))
{
if(KeyPressed[playerid] ==3)
{
KeyPressed[playerid]++;
}
}
return 1;
}