SA-MP Forums Archive
[Ajuda] Ferry bugado. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Ferry bugado. (/showthread.php?tid=573842)



Ferry bugado. - Daark - 10.05.2015

Tipo o portгo mais o navio nгo aparece ...
PHP код:
#include <a_samp>
#include "../include/gl_common.inc"
#define NUM_SHIP_ROUTE_POINTS   7
#define SHIP_HULL_ID              9585 // massive cargo ship's hull. This is used as the main object
#define SHIP_MOVE_SPEED         15.0
#define SHIP_DRAW_DISTANCE      300.0
#define NUM_SHIP_ATTACHMENTS    10
#define GREEN                   0xffffffFF
#define RED                     0xffffffFF
new holePlug;
new 
gShipRampCI;
new 
gShipRampLI;
new 
gShipFenceCI;
new 
gShipFenceLI;
new 
Hour, Minute, Second;
new 
strFerry[1000];
new 
Float:gShipHullOrigin[3] =
{-
2409.8438, 1544.9453, 7.0000}; // so we can convert world space to model space for attachment positions
new gShipAttachmentModelIds[NUM_SHIP_ATTACHMENTS] = {
9586, // Ship main platform
9761, // Ship rails
9584, // Bridge exterior
9698, // Bridge interior
9821, // Bridge interior doors
9818, // Bridge radio desk
9819, // Captain's desk
9822, // Captain's seat
9820, // Bridge ducts and lights
9590, // Cargo bay area
};
new 
Float:gShipAttachmentPos[NUM_SHIP_ATTACHMENTS][6] = {
// these are world space positions used on the original cargo ship in the game
// they will be converted to model space before attaching
{-2412.1250, 1544.9453, 17.0469,  0.0, 0.0, 0.0},
{-
2411.3906, 1544.9453, 27.0781,  0.0, 0.0, 0.0},
{-
2485.0781, 1544.9453, 26.1953,  0.0, 0.0, 0.0},
{-
2473.5859, 1543.7734, 29.0781,  0.0, 0.0, 0.0},
{-
2474.3594, 1547.2422, 24.7500,  0.0, 0.0, 0.0},
{-
2470.2656, 1544.9609, 33.8672,  0.0, 0.0, 0.0},
{-
2470.4531, 1551.1172, 33.1406,  0.0, 0.0, 0.0},
{-
2470.9375, 1550.7500, 32.9063,  0.0, 0.0, 0.0},
{-
2474.6250, 1545.0859, 33.0625,  0.0, 0.0, 0.0},
{-
2403.5078, 1544.9453, 8.7188,  0.0, 0.0, 0.0}
};
// Route points (position/rotation)
new Float:gShipRoutePoints[NUM_SHIP_ROUTE_POINTS][6] = {
{
2070.15, -3250.10, 0.0, 0.00, 0.00, 180.00},
{
2185.15, -3250.10, 0.0, 0.00, 0.00, 195.00},
{
7002.0, -1496.218, 0.0, 0.00, 0.00, 195.00},
{
7002.0, -1466.218, -3.70, 0.00, 0.00, 180.00},
{
7002.0, -1496.218, 0.0, 0.00, 0.00, 195.00},
{
2085.78, -3250.10, 0.0, 0.00, 0.00, 195.00},
{
2070.15, -3250.10, 0.0, 0.00, 0.00, 180.00}
};
new 
gShipCurrentPoint = 1; // current route point the ship is at. We start at route 1
new gMainShipObjectId;
new 
gShipsAttachments[NUM_SHIP_ROUTE_POINTS];
forward BeforeMovingTimer();
public 
BeforeMovingTimer()
{
    if(
gShipCurrentPoint == 1 || gShipCurrentPoint == 4)
    {
        
gettime(Hour, Minute, Second);
        
SendClientMessageToAll(-1, "{0065C2}-------------------------------------------------------------");
        
format(strFerry, sizeof(strFerry), "{ffffff}O ferry irб partir dentro de {0065C2}60 {ffffff}segundos!");
        
SendClientMessageToAll(GREEN, strFerry);
        
SendClientMessageToAll(-1, "{0065C2}-------------------------------------------------------------");
    }
    
SetTimer("StartMovingTimer",60*1000,0); // pause for 1 minutes
}
forward StartMovingTimer();
public 
StartMovingTimer()
{
    if(
gShipCurrentPoint == 1 || gShipCurrentPoint == 3 || gShipCurrentPoint == 4 || gShipCurrentPoint == 6)
    {
        if(
gShipCurrentPoint == 1)
        {
            
// close dock CI
            
MoveObject(gShipRampCI, 2007.0, -3202.286377, 4.0, 5, 17.1887, 0.0, 0.0); // hide CI ramp
            
MoveObject(gShipFenceCI, 2007.541504, -3230.813477, 13.131804, 0.2, -6.283184, 0.000000, 0.000000); // show CI fence
        
}
        if(
gShipCurrentPoint == 4)
        {
            
// close dock LI
            
MoveObject(gShipRampLI, 6973.289063, -1414.773560, 2.0, 5, 17.1887, 0.0000, 0.0000); // hide LI ramp
            
MoveObject(gShipFenceLI, 6973.238281, -1443.742310, 10.814490, 0.2, 0.0000, 0.0000, 0.0000); // show LI fence
        
}
        
MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
                    
gShipRoutePoints[gShipCurrentPoint][1],
                    
gShipRoutePoints[gShipCurrentPoint][2],
                    
SHIP_MOVE_SPEED / 10.0, // slower for the first route
                    
gShipRoutePoints[gShipCurrentPoint][3],
                    
gShipRoutePoints[gShipCurrentPoint][4],
                    
gShipRoutePoints[gShipCurrentPoint][5]);
    }
    else
    {
        
MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
                    
gShipRoutePoints[gShipCurrentPoint][1],
                    
gShipRoutePoints[gShipCurrentPoint][2],
                    
SHIP_MOVE_SPEED,
                    
gShipRoutePoints[gShipCurrentPoint][3],
                    
gShipRoutePoints[gShipCurrentPoint][4],
                    
gShipRoutePoints[gShipCurrentPoint][5]);
    }
}
public 
OnFilterScriptInit()
{
    
Create3DTextLabel("{FFFF00}Pressione 'F'\nPara abrir o menu de licencas", 0x008080FF, -2033.0, -100.0, 36.0, 30.0, 0);
    
// Ramps & fences
    
gShipRampCI = CreateObject(8947, 2007.0, -3242.286377, 5.760301, 17.1887, 0.0000, 0.0000); // CI ramp
    
gShipFenceCI = CreateObject(979, 2007.541504, -3230.813477, 11.631804, -6.283184, 0.000000, 0.000000); // CI fence
    
gShipRampLI = CreateObject(8947, 6973.289063, -1414.773560, 2.0, 17.1887, 0.0000, 0.0000); // LI ramp
    
gShipFenceLI = CreateObject(979, 6973.238281, -1443.742310, 10.814490, 0.0000, 0.0000, 0.0000); // LI fence
    
gMainShipObjectId = CreateObject(SHIP_HULL_ID, gShipRoutePoints[0][0], gShipRoutePoints[0][1], gShipRoutePoints[0][2],
                                    
gShipRoutePoints[0][3], gShipRoutePoints[0][4], gShipRoutePoints[0][5], SHIP_DRAW_DISTANCE);
    
SetTimer("BeforeMovingTimer",4*60*1000,0);
    
holePlug = CreateObject(3601, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE);
    
AttachObjectToObject(holePlug, gMainShipObjectId, -28.128856, -2.805774, 1.488699, 0.0, 0.0, 315.0);
    new 
x=0;
    while(
x != NUM_SHIP_ATTACHMENTS) {
        
gShipsAttachments[x] = CreateObject(gShipAttachmentModelIds[x], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SHIP_DRAW_DISTANCE);
        
AttachObjectToObject(gShipsAttachments[x], gMainShipObjectId,
                    
gShipAttachmentPos[x][0] - gShipHullOrigin[0],
                    
gShipAttachmentPos[x][1] - gShipHullOrigin[1],
                    
gShipAttachmentPos[x][2] - gShipHullOrigin[2],
                    
0.0, 0.0, 0.0);
        
//new test[1000];
        //format(test, sizeof(test),"%f %f %f\n",gShipAttachmentPos[x][0]-gShipHullOrigin[0],gShipAttachmentPos[x][1]-gShipHullOrigin[1],gShipAttachmentPos[x][2]-gShipHullOrigin[2]);
        //print(test);
        
x++;
    }
    return 
1;
}
public 
OnFilterScriptExit()
{
    
DestroyObject(gMainShipObjectId);
    new 
x=0;
    
DestroyObject(holePlug);
    while(
x != NUM_SHIP_ATTACHMENTS)
    {
        
DestroyObject(gShipsAttachments[x]);
        
x++;
    }
    return 
1;
}
public 
OnObjectMoved(objectid)
{
    if(
objectid != gMainShipObjectId) return 0;
    
gShipCurrentPoint++;
    
//new tempdebug[256+1];
    //format(tempdebug,256,"Le ferry est au point : %d", gShipCurrentPoint);
    //SendClientMessageToAll(0xFFFFFFFF,tempdebug);
    
if(gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS || gShipCurrentPoint == 3 || gShipCurrentPoint == 4 || gShipCurrentPoint == 6) {
        if(
gShipCurrentPoint == NUM_SHIP_ROUTE_POINTS) gShipCurrentPoint = 1;
        if(
gShipCurrentPoint == 1 || gShipCurrentPoint == 4)
        {
            
// Before heading to the first route we should wait a bit
            
gettime(Hour, Minute, Second);
            if(
gShipCurrentPoint == 1)
            {
                
SendClientMessageToAll(-1, "{0065C2}-------------------------------------------------------------");
                
format(strFerry, sizeof(strFerry), "{ffffff}O ferry irб partir de {0065C2}%s {ffffff}para {0065C2}%s{ffffff}, irб dar partida dentro de {0065C2}5 {ffffff}minutos.", "Islandia", "California");
                
// open dock CI
                
MoveObject(gShipRampCI, 2007.0, -3242.286377, 5.70, 5, 17.1887, 0.0, 0.0); // show CI ramp
                
MoveObject(gShipFenceCI, 2007.541504, -3230.813477, 11.631804, 0.2, -6.283184, 0.000000, 0.000000); // hide CI fence
            
}
            if(
gShipCurrentPoint == 4)
            {
                
SendClientMessageToAll(-1, "{0065C2}-------------------------------------------------------------");
                
format(strFerry, sizeof(strFerry), "{ffffff}O ferry irб partir de {0065C2}%s {ffffff}para {0065C2}%s{ffffff}, irб dar partida dentro de {0065C2}5 {ffffff}minutos.", "California", "Iislandia");
                
// open dock LI
                
MoveObject(gShipRampLI, 6973.289063, -1454.773560, 3.452109, 5, 17.1887, 0.0000, 0.0000); // show LI ramp
                
MoveObject(gShipFenceLI, 6973.238281, -1443.742310, 9.314490, 0.2, 0.0000, 0.0000, 0.0000); // hide LI fence
            
}
            
SendClientMessageToAll(GREEN, strFerry);
            
SendClientMessageToAll(-1, "{0065C2}-------------------------------------------------------------");
            
SetTimer("BeforeMovingTimer",4*60*1000,0); // pause for 4 minutes
            
return 1;
        }
           
MoveObject(gMainShipObjectId,gShipRoutePoints[gShipCurrentPoint][0],
                               
gShipRoutePoints[gShipCurrentPoint][1],
                               
gShipRoutePoints[gShipCurrentPoint][2],
                               
SHIP_MOVE_SPEED / 10.0, // slower
                               
gShipRoutePoints[gShipCurrentPoint][3],
                               
gShipRoutePoints[gShipCurrentPoint][4],
                               
gShipRoutePoints[gShipCurrentPoint][5]);
        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;
} 



Re: Ferry bugado. - Vegassilva - 11.05.2015

As suas Coordenadas pode estб erradas