02.06.2011, 11:58
Okay heres the code,
First, the keys defined under OnPlayerUpdate:
And Second, the keys defined under OnPlayerKeyStateChange:
First, the keys defined under OnPlayerUpdate:
Код:
public OnPlayerUpdate(playerid) { new Keys,ud,lr; GetPlayerKeys(playerid,Keys,ud,lr); if(MakeBoatControllable==1) { if(ud > 0) { new Float:x1, Float:y1, Float:z1; GetObjectPos(PirateShip, x1, y1, z1); new Float:x2, Float:y2, Float:z2; GetObjectPos(PirateShip, x2, y2, z2); MoveObject(PirateShip, x1+ShipMovingValue, y1, z1, ShipSpeed); MoveObject(PirateShippart, x2+ShipMovingValue, y2, z2, ShipSpeed); } else if(ud < 0) { new Float:x1, Float:y1, Float:z1; GetObjectPos(PirateShip, x1, y1, z1); new Float:x2, Float:y2, Float:z2; GetObjectPos(PirateShip, x2, y2, z2); MoveObject(PirateShip, x1-ShipMovingValue, y1, z1, ShipSpeed); MoveObject(PirateShippart, x2-ShipMovingValue, y2, z2, ShipSpeed); } else if(lr > 0) { new Float:x1, Float:y1, Float:z1; GetObjectPos(PirateShip, x1, y1, z1); new Float:x2, Float:y2, Float:z2; GetObjectPos(PirateShip, x2, y2, z2); MoveObject(PirateShip, x1, y1+ShipMovingValue, z1, ShipSpeed); MoveObject(PirateShippart, x2, y2+ShipMovingValue, z2, ShipSpeed); } else if(lr < 0) { new Float:x1, Float:y1, Float:z1; GetObjectPos(PirateShip, x1, y1, z1); new Float:x2, Float:y2, Float:z2; GetObjectPos(PirateShip, x2, y2, z2); MoveObject(PirateShip, x1, y1-ShipMovingValue, z1, ShipSpeed); MoveObject(PirateShippart, x2, y2-ShipMovingValue, z2, ShipSpeed); } } }
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(MakeBoatControllable==1) { if (newkeys & KEY_CROUCH) { new Float:RotX,Float:RotY,Float:RotZ; GetObjectRot(PirateShip, RotX, RotY, RotZ); new Float:RotX2,Float:RotY2,Float:RotZ2; GetObjectRot(PirateShip, RotX2, RotY2, RotZ2); SetObjectRot(PirateShip, RotX, RotY, RotZ+3); SetObjectRot(PirateShippart, RotX2, RotY2, RotZ2+3); } if (newkeys & KEY_JUMP) { new Float:RotX,Float:RotY,Float:RotZ; GetObjectRot(PirateShip, RotX, RotY, RotZ); new Float:RotX2,Float:RotY2,Float:RotZ2; GetObjectRot(PirateShip, RotX2, RotY2, RotZ2); SetObjectRot(PirateShip, RotX, RotY, RotZ-3); SetObjectRot(PirateShippart, RotX2, RotY2, RotZ2-3); } } }