SA-MP Forums Archive
OnPlayerKeyStateChange QUICK 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerKeyStateChange QUICK HELP (/showthread.php?tid=102167)



OnPlayerKeyStateChange QUICK HELP - BP13 - 13.10.2009

pawn Код:
if(newkeys == KEY_HORN) //Its not suppose to say horn. what do I put here for the button H
    {
        new
            Float:x,
            Float:y,
            Float:z;
        GetPlayerPos(playerid, x, y, z);
        SetPlayerPos(playerid, x, y, z + 10.0);
    }
  if(newkeys == KEY_NITRO) //Nitro Doesnt exist What key would it say for Alt
    {
      if(IsPlayerInAnyVehicle(playerid))
        {
        new Float:s[3];
          GetVehicleVelocity(GetPlayerVehicleID(playerid),s[0],s[1],s[2]);
          s[0]=1.5*s[0];
          s[1]=1.5*s[1];
          s[2]=1.5*s[2];
          SetVehicleVelocity(GetPlayerVehicleID(playerid),s[0],s[1],s[2]);
        }
        return 1;
    }



Re: OnPlayerKeyStateChange QUICK HELP - Joe Staff - 13.10.2009

I know that the nitro button is defined as KEY_FIRE, I don't recall with the horn button is defined as, if it even is.


Re: OnPlayerKeyStateChange QUICK HELP - Danny_Costelo - 13.10.2009

The horn key is KEY_CROUCH
KEY_FIRE for ALT.


Re: OnPlayerKeyStateChange QUICK HELP - BP13 - 14.10.2009

can anyone tell me why the speed thing is only working 1/2 of the time? whats wrong with my code?


Re: OnPlayerKeyStateChange QUICK HELP - yom - 14.10.2009

Probably because your code ignore keys combinations.


Re: OnPlayerKeyStateChange QUICK HELP - BP13 - 14.10.2009

Quote:
Originally Posted by 0rb
Probably because your code ignore keys combinations.
what do you suggest I change.

- Also the Jumping one moves your player up but doesnt bring your car with you. its basically a giant slap.


Re: OnPlayerKeyStateChange QUICK HELP - Danny_Costelo - 14.10.2009

Quote:
Originally Posted by [SU
BP13 ]
Quote:
Originally Posted by 0rb
Probably because your code ignore keys combinations.
what do you suggest I change.

- Also the Jumping one moves your player up but doesnt bring your car with you. its basically a giant slap.
That's because your using SetPlayerPos, use SetVehiclePos.. seriously use the wiki before posting, you need the least bit of knowledge for us to help you.


Re: OnPlayerKeyStateChange QUICK HELP - BP13 - 14.10.2009

Quote:
Originally Posted by |№іі7
Quote:
Originally Posted by [SU
BP13 ]
Quote:
Originally Posted by 0rb
Probably because your code ignore keys combinations.
what do you suggest I change.

- Also the Jumping one moves your player up but doesnt bring your car with you. its basically a giant slap.
That's because your using SetPlayerPos, use SetVehiclePos.. seriously use the wiki before posting, you need the least bit of knowledge for us to help you.
I took these examples from wiki, so don't say I didn't check wiki.

I guess you don't know how to deal with this either cause I did what you did and now it does nothing at all.


Re: OnPlayerKeyStateChange QUICK HELP - Joe Staff - 14.10.2009

SetVehiclePos(GetPlayerVehicleID(playerid),...);

Use it like that.