How to /flip using the alt key?
#1

Hi I am creating a lan server but I am relatively new to Pawno so if you can be specific with this one that would help a lot. But anyways I searched up my question and it seems very easy to make your car flip using /flip but I am looking for a way to make it flip using the alt key. I know it can be done because I've been in a couple of servers that do it that way. Thanks very much for your help.
Reply
#2

Im not sure but maybe rotate it 180?
Reply
#3

Thanks for the input. I know that aspect of it (generally... dont know how to code it) all I have to do for that part is reset z angle (im pretty sure). But the part I don't know is how to control it by using the alt key.
Reply
#4

You need to combine OnPlayerKeyStateChange and SetVehicleZAngle Like so:

pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
  if(IsPlayerInAnyVehicle(playerid) && newkeys &= 4)
  {
    new Float:ZAngle;
    GetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
    SetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
  }
  return 1;
}
Reply
#5

Thanks I'll try that out and let you know how it goes
Reply
#6

After trying to compile I get this:

C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\sampserver\filtersc ripts\altflip.pwn(181) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.




If I am not mistaken... it's a filterscript right? So to make a filterscript you uncomment the #define filterscript at the top... and that's all to turn it into a filterscript right?
Reply
#7

Sorry, that won't compile :P, this will work

pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(newkeys &= 4)
    {
      new Float:ZAngle;
      GetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
      SetVehicleZAngle(GetPlayerVehicleID(playerid),ZAngle);
    }
  }
  return 1;
}
Also, please don't double-post, use the edit button.
Reply
#8

Ok will use the edit button

Thanks sooo much for your help it helped a lot. But I have one last question, the alt works at resetting the z angle, but is it possible to also make them appear like, a foot above where they were? Because when the angle alone is repositioned it tends to glitch up in certain spots form what I've found on other servers... so I think that making them appear I tiny bit higher so they don't appear half way in the ground would fix it.

its not exactly like resetting the z axis, more like adding on a bit, which is something I have no idea how to do.
Reply
#9

Indeed, simply do similiar but add on to the Z co-ordinates

pawn Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(newkeys &= 4)
    {
      new Float:ZAngle,Float:X,Float:Y,Float:Z,vehicleid;
      vehicleid = GetPlayerVehicleID(playerid);
      GetVehiclePos(vehicleid,X,Y,Z);
      GetVehicleZAngle(vehicleid,ZAngle);
      SetVehicleZAngle(vehicleid,ZAngle);
      SetVehiclePos(vehicleid,X,Y,Z+2);
    }
  }
  return 1;
}
Since we are using GetPlayerVehicleID(playerid); so much, I've used it just once in the script and stored it in a variable for use instead of calling it every time
Reply
#10

Thanks soo much for your help. Yesterday was my first day with pawno, so you can imagine how much it helps. I can read and edit it well enough already I think, but writing it is a different story. Thanks again.

For others who want to use it, for me, it compiles properly and seems to work in-game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)