Flight Script, ID 0 always getting teleported to LS
#1

I know this is a very long code, but i can't see why ID 0 is always getting tele'd to LS or whatever city.
Please help me.

pawn Код:
#include <a_samp>
#include <dini>
#include <dutils>

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define rand(%1,%2) (random(%2 - %1 - 1) + %1 + 1)

#define COLOR_RED           0xAA3333AA
#define COLOR_PINK          0xFF66FFAA
#define COLOR_LIGHTBLUE     0x33CCFFAA

#define FLTime_LosSantos  58
#define FLTime_SanFierro  43
#define FLTime_LasVenturas 41

new InPlane[MAX_PLAYERS];
new FlightTime[MAX_PLAYERS];
new Destination[MAX_PLAYERS];
new player;
new Timer;

forward PlaneTime();
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(fly, 3, cmdtext);
    return 0;
}
pawn Код:
dcmd_fly(playerid, params[])
{
  #pragma unused params
  #pragma unused playerid
 
    if (strval(params) < 1 || strval(params) > 3)
    {
        SendClientMessage(playerid, 0xAA0000FF, "Usage: /fly [1-3]");
        SendClientMessage(playerid, 0xAA0000FF, "1 - Los Santos");
        SendClientMessage(playerid, 0xAA0000FF, "2 - San Fierro");
        SendClientMessage(playerid, 0xAA0000FF, "3 - Las Venturas");
        return 0;
    }
   
    switch (strval(params))
    {
        case 1: Destination[playerid] = 1;
        case 2: Destination[playerid] = 2;
        case 3: Destination[playerid] = 3;
    }

    if(InPlane[playerid] == 1)
    {
        GameTextForPlayer(playerid, "Already in plane!", 3000, 4);
    } else {
        InPlane[playerid] = 1;
        SetPlayerInterior(playerid, 1);
        SetPlayerPos(playerid, 1.2649, 26.3358, 1199.5938);
        player = playerid;

        switch (Destination[playerid])
        {
            case 1: FlightTime[playerid] = FLTime_LosSantos;
            case 2: FlightTime[playerid] = FLTime_SanFierro;
            case 3: FlightTime[playerid] = FLTime_LasVenturas;
        }

    new string[128];
    format(string, sizeof(string), "~w~Flight Time: ~g~00:%d", FlightTime[playerid]);

        GameTextForPlayer(player, string, 3000, 4);
        Timer = SetTimer("PlaneTime", 1000, true);

        new name[MAX_PLAYER_NAME+1];
        GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "Name: %s (%d)", name, playerid);
      SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

        switch (Destination[playerid])
        {
            case 1: SendClientMessage(playerid, COLOR_LIGHTBLUE, "Destination: Los Santos");
            case 2: SendClientMessage(playerid, COLOR_LIGHTBLUE, "Destination: San Fierro");
            case 3: SendClientMessage(playerid, COLOR_LIGHTBLUE, "Destination: Las Venturas");
        }
        format(string, sizeof(string), "Flight Time: %d Seconds", FlightTime[playerid]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
       
        // **Flight Information ** //
        GetPlayerName(playerid, name, sizeof(name));
   
        print("\n\n** New Flight**");
        printf("Name: %s (%d)", name, playerid);
       
        switch (Destination[playerid])
        {
            case 1: print("Destination: Los Santos");
            case 2: print("Destination: San Fierro");
            case 3: print("Destination: Las Venturas");
        }
       
        printf("Flight Time: %d Seconds", FlightTime[playerid]);
    }
    return 1;
}
pawn Код:
public PlaneTime()
{
    new string[128];
   
    if(FlightTime[player] == 0) {
      KillTimer(Timer);
     
        switch (Destination[player])
        {
            case 1:
            {
                printf("ID %d: Successfully Arrived At Los Santos!", player);
                SetPlayerInterior(player, 0);
                SetPlayerPos(player, 1686.3303, -2324.8582, 13.5469);
                GameTextForPlayer(player, "~g~Welcome to ~b~~h~~h~Los Santos!", 3000, 0);
            }
           
            case 2:
            {
                printf("ID %d: Successfully Arrived At San Fierro!", player);
                SetPlayerInterior(player, 0);
                GameTextForPlayer(player, "~g~Welcome to ~b~~h~~h~San Fierro!", 3000, 0);
            }
            case 3:
            {
        printf("ID %d: Successfully Arrived At Las Venturas!", player);
        SetPlayerInterior(player, 0);
        GameTextForPlayer(player, "~g~Welcome to ~b~~h~~h~Las Venturas!", 3000, 0);
            }
        }

        InPlane[player] = 0;
    } else {
        FlightTime[player] -= 1;
        printf("ID %d: %d Seconds Left Until Arrival.", player, FlightTime[player]);

        if(FlightTime[player] > 9)
        {
            format(string, sizeof(string), "~w~Flight Time: ~g~00:%d", FlightTime[player]);
        } else {
          format(string, sizeof(string), "~w~Flight Time: ~g~00:0%d", FlightTime[player]);
        }
        GameTextForPlayer(player, string, 3000, 4);
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)