OnPlayerKeyStateChange help
#1

Sorry I wasn't to sure what to name the title, anyway..

I am new to Pawno and giving it a go by editing a script to gain knowledge for I can make my own one day.
I am changing where you use command /enter and /exit to be able to enter and exit with a key.
I have got entering scripted fine by using;
PHP код:
if(newkeys == KEY_SECONDARY_ATTACK)
  {
//Chunk of code etc.. 
tested it and it works fine.
However,which I'll seem noob and you may laugh, I tried the same thing for exit but I just got a lot of errors saying stuff like:
> invalid function or declaration
> number of arguments does not match definition

I'm assuming that I don't use if(newkeys == KEY_SECONDARY_ATTACK){ again lol? so what would I use?

I want players to be able to press ENTER key to enter a building and exit.

Sorry if I never explained this well enough.
Any help will be extremely helpful and appreciated as I will be learning off of this.
Reply
#2

use

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/SetPlayerPos
Reply
#3

Just put it under the same place. This is an example:

pawn Код:
if(newkeys == KEY_SECONDARY_ATTACK)
{
    if(IsPlayerInRangeOfPoint(playerid, HousePosX, HousePosY, HousePosZ, 5))
    {
        //do Something if at enter pos
    }
    else if(IsPlayerInRangeOfPoint(playerid, HouseExitPosX, HouseExitPosY, HouseExitPosZ, 5))
    {
        //Do something if at exit pos
    }
}
Reply
#4

I've tried those man. Read over them a few times and tried some shit but still running into errors.
Reply
#5

What errors? Post the way you did it, and pawno errors please
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)