SA-MP Forums Archive
OnPlayerKeyStateChange help - 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: OnPlayerKeyStateChange help (/showthread.php?tid=369162)



OnPlayerKeyStateChange help - aaronwelsh - 16.08.2012

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.


Re : OnPlayerKeyStateChange help - Naruto_Emilio - 16.08.2012

use

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/SetPlayerPos


Re: OnPlayerKeyStateChange help - Kindred - 16.08.2012

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
    }
}



Re: Re : OnPlayerKeyStateChange help - aaronwelsh - 16.08.2012

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
I've tried those man. Read over them a few times and tried some shit but still running into errors.


Re: OnPlayerKeyStateChange help - SaYrOn - 16.08.2012

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