help me i want script open gate to key "H"
#1

how to make this open gate to key "H". i don't want cmd example /lspd.... i want open gate this key "H" please write this script... link and this script (
Reply
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((oldkeys & KEY_CROUCH) && !(newkeys & KEY_CROUCH))
    {
        // do your code here to open the gate
    }
    return 1;
}
Reply
#3

Konstantinos, he want to open gate from Key "H" ... Usually its Horn...it can be like this :

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if((oldkeys & KEY_HORN))
     {
           //Your Code here
     }
     return 1;
}
Reply
#4

Actually my post was wrong. I was typing fast and as a result, I wrote them opposite.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
    {
        // do your code here to open the gate
    }
    return 1;
}
Your method checks for the oldkeys as well as my previous post which was wrong.

Anyways, thanks for replying and I found out my mistake!
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Actually my post was wrong. I was typing fast and as a result, I wrote them opposite.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
    {
        // do your code here to open the gate
    }
    return 1;
}
Your method checks for the oldkeys as well as my previous post which was wrong.

Anyways, thanks for replying and I found out my mistake!
but i want key h
Reply
#6

Quote:
Originally Posted by dodari1
Посмотреть сообщение
but i want key h
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_HORN) && !(oldkeys & KEY_HORN))
    {
        // your rest of cmd here..
    }
    return 1;
}
Reply
#7

thanks all :
Reply
#8

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_HORN) && !(oldkeys & KEY_HORN))
    {
        // your rest of cmd here..
    }
    return 1;
}
undefined symbol "KEY_HORN" how to fix?
Reply
#9

ops sorry about this , check samp keys from here : https://sampwiki.blast.hk/wiki/Keys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)