SA-MP Forums Archive
Who can help me - 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)
+--- Thread: Who can help me (/showthread.php?tid=646776)



Who can help me - hoanduy - 23.12.2017

How to press key as in this video https://www.youtube.com/watch?time_c...&v=jtwl1ZATR6c


Re: Who can help me - cuber - 23.12.2017

Use the keyboard numpad:



Re: Who can help me - hoanduy - 23.12.2017

Quote:
Originally Posted by cuber
Посмотреть сообщение
Use the keyboard numpad:
My intention is to make this system for SA-MP


Re: Who can help me - cuber - 23.12.2017

Quote:
Originally Posted by hoanduy
Посмотреть сообщение
My intention is to make this system for SA-MP
You didn't say that earlier.


Re: Who can help me - RogueDrifter - 23.12.2017

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.


Re: Who can help me - hoanduy - 23.12.2017

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
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.
But how to press the right time, that is what I'm afraid


Re: Who can help me - RogueDrifter - 23.12.2017

didn't you just read what i said man, here is an example code:
PHP код:
new KeyPressed[MAX_PLAYERS];

#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
    
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    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;

this is an example of right down left up in the exact order.


Re: Who can help me - GTLS - 24.12.2017

I think he meant Marquee arrows and to check if its inside the middle circle or not when a user presses a particular key. after that, your code comes to check weather the key pressed is correct one or not.