using get player keys, should be easy help + rep.
#1

pawn Код:
if (newkeys == KEY_SECONDRY_FIRE)
        {
            if(GetPlayerInterior < 1) return cmd_enter;
            else if(GetPlayerInterior >= 1) return cmd_exit;
        }
Samp wiki isn't very helpful, i've done this... Any ideas what the proper code is? I get five errors using this.
Reply
#2

KEY_SECONDARY_FIRE

You missed an 'A'.

EDIT: Full code
pawn Код:
if (newkeys == KEY_SECONDARY_FIRE)
        {
            if(GetPlayerInterior(playerid) < 1) return cmd_enter;
            else if(GetPlayerInterior(playerid) >= 1) return cmd_exit;
        }
Reply
#3

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
KEY_SECONDARY_FIRE

You missed an 'A'.

EDIT: Full code
pawn Код:
if (newkeys == KEY_SECONDARY_FIRE)
        {
            if(GetPlayerInterior(playerid) < 1) return cmd_enter;
            else if(GetPlayerInterior(playerid) >= 1) return cmd_exit;
        }
Woah woops haha, three errors.
pawn Код:
hrp.pwn(18653) : error 017: undefined symbol "newkeys"
hrp.pwn(18655) : error 076: syntax error in the expression, or invalid function call
hrp.pwn(18656) : error 076: syntax error in the expression, or invalid function call
Reply
#4

Oh sorry, I'm thinking of OnPlayerKeyStateChange. Give me a second and I will edit this post.

EDIT: I'm still confused as to what you're trying to script. Can you please post the WHOLE function/command or whatever it is you are using GetPlayerKeys in?
Reply
#5

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
Oh sorry, I'm thinking of OnPlayerKeyStateChange. Give me a second and I will edit this post.

EDIT: I'm still confused as to what you're trying to script. Can you please post the WHOLE function/command or whatever it is you are using GetPlayerKeys in?
I'm using public OnPlayerUpdate(playerid) should i use OnPlayerKeyStateChange instead? I'm basically trying to just make it so you press f IG to enter/exit buildings.
Reply
#6

he missed out the _

This if (newkeys == KEY SECONDARY FIRE)
To if (newkeys == KEY_SECONDARY_FIRE)
Reply
#7

Quote:
Originally Posted by Ultra-Gaming
Посмотреть сообщение
he missed out the _

This if (newkeys == KEY SECONDARY FIRE)
To if (newkeys == KEY_SECONDARY_FIRE)
No I didn't?

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_FIRE)
    {
        if(GetPlayerInterior(playerid) < 1)
        return cmd_enter;
        else if(GetPlayerInterior(playerid) >= 1)
        return cmd_exit;
    }
    return 1;
}
If it gives you an error for KEY_SECONDARY_FIRE, change it to KEY_SECONDARY_ATTACK
Reply
#8

Quote:
Originally Posted by Ultra-Gaming
Посмотреть сообщение
he missed out the _

This if (newkeys == KEY SECONDARY FIRE)
To if (newkeys == KEY_SECONDARY_FIRE)
No I had the _..
Reply
#9

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
No I didn't?

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SECONDARY_FIRE)
    {
        if(GetPlayerInterior(playerid) < 1)
        return cmd_enter;
        else if(GetPlayerInterior(playerid) >= 1)
        return cmd_exit;
    }
    return 1;
}
If it gives you an error for KEY_SECONDARY_FIRE, change it to KEY_SECONDARY_ATTACK
hrp.pwn(18365) : error 017: undefined symbol "enter"
hrp.pwn(18366) : error 029: invalid expression, assumed zero

I get them, any idea how to call a command?
Reply
#10

Post your commands for Enter and Exit.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)