i want to make press "c" for teleport and ..
#1

Hi , i want to change "/enter" is press "C" for teleport

and press "Shift" for Start Engine

what should i do ? , teach me. I want to learn it. (i'm beginner)


Sorry for my bad english ,If you do not understand (i'm thai)
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#3

Try this https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#4

you have a simple of this ?
Reply
#5

for "C" try
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        #define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
	if (PRESSED(KEY_CROUCH))
	{
            your command here
	}
   }
   return 1;
Reply
#6

You don't really want to use 'PRESSED', because if the player is holding it, let alone pressing it once, it will teleport him multiple times.
Reply
#7

i know but he didnt mention what teleport he want ... and what is it going to be (pressing or holding)
Reply
#8

Doesn't matter what kind of teleport it is, nobody is going to want to teleport to the same place, more than once at a time.
Reply
#9

pawn Код:
CMD:enter(playerid, params[])
{
    //code here
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_CROUCH)
    {
        //the code from /enter goes here.
    }
    return 1;
}
Reply
#10

Quote:
Originally Posted by maramizo
Посмотреть сообщение
pawn Код:
CMD:enter(playerid, params[])
{
    //code here
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_CROUCH)
    {
        //the code from /enter goes here.
    }
    return 1;
}
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_CROUCH)
    {
        //the code from /enter goes here.
    }
    return 1;
}
You just put & instead of == :S
To be completely honest, I'm sure if that even makes a difference, but just in case.

EDIT: I'm not sure*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)