Szerző Téma: Felvono próbléma  (Megtekintve 696 alkalommal)

Felvono próbléma
« Dátum: 2015. Május 27. - 20:02:57 »
0 Show voters
Helló az a próblémám lenne hogy amikor felér a felvonó a 2-dik kordinátához akkor nem áll meg 30 mp hanem egyből lemegy és amikor lent van csak akkor áll 30 mp. Úgy szeretném hogy mind a 2-nél álljon 30 mp. Van valakinek valami ötlete hogy lehetne megoldani?
 

#include <a_samp>
#include \"../include/gl_common.inc\" // for PlaySoundForPlayersInRange()
#define NUM_SHIP_ROUTE_POINTS   2
#define SHIP_OBJECT_ID          5837 // pirate ship
#define SHIP_MOVE_SPEED         40
#define SHIP_DRAW_DISTANCE      800.0
// Pirate ship route points (position/rotation)
new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = {
{-2102.3003, -2226.0457, 33.7934,  -0.0400, 0.0000, -219.9600},
{-2279.5198, -1818.1901, 484.2934, -0.0400, 0.0000, -219.9600}
};
 
//new gShipCurrentPoint = 1; // current route point the ship is at
new gShipCurrentPoint = 0;
// SA-MP objects
new gMainShipObjectId;
forward StartMovingTimer();
//-------------------------------------------------
public StartMovingTimer()
{
MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
gShipRoutePoints[gShipCurrentPoint][1],
gShipRoutePoints[gShipCurrentPoint][2],
SHIP_MOVE_SPEED / 4.0, // bit slower for the first point
gShipRoutePoints[gShipCurrentPoint][3],
gShipRoutePoints[gShipCurrentPoint][4],
gShipRoutePoints[gShipCurrentPoint][5]);
}
//-------------------------------------------------
public OnFilterScriptInit()
{
gMainShipObjectId = CreateObject(SHIP_OBJECT_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][2],
gShipRoutePoints[0][3], gShipRoutePoints[0][4], gShipRoutePoints[0][5], SHIP_DRAW_DISTANCE);
SetTimer(\"StartMovingTimer\",30*1000,0); // pause at route 0 for 30 seconds
return 1;
}
//-------------------------------------------------
public OnFilterScriptExit()
{
    DestroyObject(gMainShipObjectId);
return 1;
}
//-------------------------------------------------
public OnObjectMoved(objectid)
{
    if(objectid != gMainShipObjectId) return 0;
if(gShipCurrentPoint > 0 && !(gShipCurrentPoint % 1)) {
}
    gShipCurrentPoint++;
    if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS) {
gShipCurrentPoint = 0;
         MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
        gShipRoutePoints[gShipCurrentPoint][1],
gShipRoutePoints[gShipCurrentPoint][2],
SHIP_MOVE_SPEED / 4.0, // slower for the last route
gShipRoutePoints[gShipCurrentPoint][3],
gShipRoutePoints[gShipCurrentPoint][4],
gShipRoutePoints[gShipCurrentPoint][5]);
return 1;
}
if(gShipCurrentPoint == 1) {
    // Before heading to the first route we should wait a bit
StopObject(gMainShipObjectId);
    SetTimer(\"StartMovingTimer\",30*1000,0); // pause at route 0 for 30 seconds
return 1;
}
    MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
gShipRoutePoints[gShipCurrentPoint][1],
gShipRoutePoints[gShipCurrentPoint][2],
SHIP_MOVE_SPEED,
gShipRoutePoints[gShipCurrentPoint][3],
gShipRoutePoints[gShipCurrentPoint][4],
gShipRoutePoints[gShipCurrentPoint][5]);
 
return 1;
}
« Utoljára szerkesztve: 2015. Május 27. - 21:56:32 írta ƒlaﻛh »

Nem elérhető Kovacs_Richard

  • 1743
  • HRP Fejlesztő
  • Discord: Kovacs_Richard#0321
    • Profil megtekintése
    • Hun Role Play Web
Felvono próbléma
« Válasz #1 Dátum: 2015. Május 28. - 09:00:29 »
0 Show voters
Tesztelni nem tudtam, majd írd meg milyen :)
 
#include <a_samp>
#define NUM_SHIP_ROUTE_POINTS   2
#define SHIP_OBJECT_ID          5837 // pirate ship
#define SHIP_DRAW_DISTANCE      800.0
forward StartShipTimer();
forward MoveShip();
// Hajó Object
new ShipObject;
// Hajó aktuális útvonal
new ShipRoute;
// Útvonal adatszerkezet
enum RouteData
{
Float:Pos[3],
Float:Rot[3],
Float:Speed,
StopTime
};
// Útvonal Adatok
new Float:ShipRoutePoints[NUM_SHIP_ROUTE_POINTS][RouteData] =
{
// 0
{
    // Pos
{-2102.3003, -2226.0457, 33.7934},
// Rot
{-0.0400, 0.0000, -219.9600},
// Speed
40.0,
// StopTime (millisec)
30000
},
// 1
{
    // Pos
{-2279.5198, -1818.1901, 484.2934},
// Rot
{-0.0400, 0.0000, -219.9600},
4.0,
// StopTime (millisec)
30000
}
};
// Amikor betöltődik a script
public OnFilterScriptInit()
{
// Hajó létrehozása
ShipRoute = 0;
    ShipObject = CreateObject(SHIP_OBJECT_ID,ShipRoutePoints[shipRoute][Pos][0],ShipRoutePoints[shipRoute][Pos][1],ShipRoutePoints[shipRoute][Pos][2],ShipRoutePoints[shipRoute][Rot][0],ShipRoutePoints[shipRoute][Rot][1],ShipRoutePoints[shipRoute][Rot][2],SHIP_DRAW_DISTANCE);
// Hajó időzítő indítása
StartShipTimer();
return 1;
}
// Amikor kitöltődik a script
public OnFilterScriptExit()
{
DestroyObject(ShipObject);
return 1;
}
// Amikor megállt egy tárgy
public OnObjectMoved(objectid)
{
// HA a mozgatott tárgy a Hajó
if(objectid == ShipObject)
{
    // Hajó időzítő indítása
    StartShipTimer();
}
return 1;
}
// Hajó mozgatása
public MoveShip()
{
// Következő útvonalra ugrás
    ShipRoute++;
// Ha végig ment akkor újra kezdi
if(ShipRoute >= NUM_SHIP_ROUTE_POINTS) { ShipRoute = 0; }
// Hajó mozgatása
MoveObject(ShipObject,ShipRoutePoints[shipRoute][Pos][0],ShipRoutePoints[shipRoute][Pos][1],ShipRoutePoints[shipRoute][Pos][2],ShipRoutePoints[shipRoute][speed],ShipRoutePoints[shipRoute][Rot][0],ShipRoutePoints[shipRoute][Rot][1],ShipRoutePoints[shipRoute][Rot][2]);
return 1;
}
// Hajó időzítő indítása
public StartShipTimer()
{
// HA NEM kell állnia
if(ShipRoutePoints[shipRoute][stopTime] == 0)
{
    // Hajó mozgatása
    MoveShip();
}
// HA állnia kell
else
{
    // Állás után Hajó mozgatása
       SetTimer(\"MoveShip\",ShipRoutePoints[shipRoute][stopTime],false);
}
}
Régóta nem tevékenykedem, mint SA-MP scripter.
HRP Fejlesztő.

Felvono próbléma
« Válasz #2 Dátum: 2015. Május 28. - 13:02:12 »
0 Show voters
köszi megy :D

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal