Szerző Téma: Buszos Munka  (Megtekintve 1194 alkalommal)

Buszos Munka
« Dátum: 2011. október 19. - 15:56:52 »
0 Show voters
Sziasztok!
Valaki meg csinálná ennek az amx ét és föltenné ide? nekem lefagy mikor probálom megcsinálni...
[pawn]#include <a_samp>
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define   YELLOW 0xFFFF00AA
#define LIME 0x00FF00FF
#define PRESSED(%0) \\
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define HOLDING(%0) \\
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \\
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define buspoint1 -1998.7400,174.6382,27.6473
#define buspoint2 -1805.8813,600.1848,34.8620
#define buspoint3 -1601.1205,726.2743,11.1720
#define buspoint4 -1612.7714,857.1121,7.6761
#define buspoint5 -1766.0300,935.1175,24.8755
#define buspoint6 -1904.0560,811.3516,36.1556
#define buspoint7 -2648.9529,570.7150,14.5943
#define buspoint8 -2614.7012,215.6137,5.2519
#define buspoint9 -2150.6584,148.2724,35.3053
#define buspoint10 -2061.5159,-74.0719,34.8552
new IsBusJob[MAX_PLAYERS];
new bus1;
new bus2;
new bus3;
new busdriver[MAX_PLAYERS];
public OnFilterScriptInit()
{
bus1 = AddStaticVehicle(431,-1988.7975,192.1375,27.6358,359.7323,75,59); // bus1
bus2 =   AddStaticVehicle(431,-1988.8607,178.5440,27.6378,359.7324,75,59); // bus2
bus3 =   AddStaticVehicle(431,-1988.9200,165.7481,27.6426,359.7370,75,59); // bus3
}
public OnPlayerCommandText(playerid, cmdtext&#91;])
{
    if (strcmp(\"/start\", cmdtext, true, 10) == 0)
    {
    new veh = GetPlayerVehicleID(playerid);
   if(veh == bus3 || veh == bus2 || veh == bus1)
    {
      busdriver[playerid] = 1;
      SetPlayerCheckpoint(playerid, buspoint1, 3.0);
      GameTextForPlayer(playerid, \"~g~Bus Driver Started!\", 3000, 3);
      new name[MAX_PLAYER_NAME], string[48];
      GetPlayerName(playerid, name, sizeof(name));
      format(string, sizeof(string), \"%s Is Now A Bus Driver!.\", name );
      SendClientMessageToAll(COLOR_RED, string);
      return 1;
      }
    SendClientMessage(playerid, COLOR_RED,\"You have to be in a bus to start the job\");
    }
    if (strcmp(\"/busdriverinfo\", cmdtext, true, 10) == 0)
    {
      SendClientMessage(playerid, COLOR_YELLOW, \".\");
      SendClientMessage(playerid, COLOR_YELLOW, \".\");
      SendClientMessage(playerid, COLOR_YELLOW, \".\");
      SendClientMessage(playerid, COLOR_YELLOW, \"!\");
      return 1;
    }
    return 0;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
  busdriver[playerid] = 0;
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  new veh = GetPlayerVehicleID(playerid);
if(veh == bus3 || veh == bus2 || veh == bus1)
if (newkeys==KEY_SUBMISSION && IsBusJob[playerid] == 0 && veh == bus1 || veh == bus3 || veh == bus2) // checks if Submission key is pressed + if the player is already working + that the player is in a bus
{
  SendClientMessage(playerid, LIME, \"You started working for the bus company!\"); // SCM only one time cause the variable under here.
  IsBusJob[playerid] = 1; // here\'s the variable set to 1, this will prevent the player from starting working over again.
  busdriver[playerid] = 1;
      SetPlayerCheckpoint(playerid, buspoint1, 3.0);
      GameTextForPlayer(playerid, \"~g~Bus Driver Started!\", 3000, 3);
      new name[MAX_PLAYER_NAME], string[48];
      GetPlayerName(playerid, name, sizeof(name));
      format(string, sizeof(string), \"%s Is Now A Bus Driver!.\", name );
      SendClientMessageToAll(LIME, string);
        SendClientMessage(playerid, COLOR_RED,\"You Have To Be In A Bus To Start The Mission!\");
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
new veh = GetPlayerVehicleID(playerid);
if(veh == bus3 || veh == bus2 || veh == bus1)
  {
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint1))
   {
     SetPlayerCheckpoint(playerid, buspoint2, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The San Fierro Train Station, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint2))
   {
     SetPlayerCheckpoint(playerid, buspoint3, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The Cluckin Bell, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint3))
   {
     SetPlayerCheckpoint(playerid, buspoint4, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The Police Station, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint4))
   {
     SetPlayerCheckpoint(playerid, buspoint5, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The San Fierro Bank, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint5))
   {
     SetPlayerCheckpoint(playerid, buspoint6, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The Burger Shot, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint6))
   {
     SetPlayerCheckpoint(playerid, buspoint7, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At Ammunation, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint7))
   {
     SetPlayerCheckpoint(playerid, buspoint8, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The , Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint8))
   {
     SetPlayerCheckpoint(playerid, buspoint9, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At , Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint9))
   {
     SetPlayerCheckpoint(playerid, buspoint10, 7.0);
     SendClientMessage(playerid, LIME,\"Arrived At The Don\'s RubberShop, Received 500$\");
     GivePlayerMoney(playerid, 500);
     }
   if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint10))
   {
        SendClientMessage(playerid, LIME,\"Type /Start Again To Start The BusDriver Mission!\");
        GivePlayerMoney(playerid, 500);
        DisablePlayerCheckpoint(playerid);
           busdriver[playerid] = 0;
   }
  }
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(!ispassenger){
    if(vehicleid == bus3 || vehicleid == bus2 || vehicleid == bus1)
    {
      SendClientMessage(playerid, YELLOW, \"START THE BUS MISSION BY PRESSING 2\");
      GameTextForPlayer(playerid, \"~y~START THE BUS DRIVER MISSION BY~n~~b~PRESSING 2!\",3000,3);
    }
  }
  return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if((busdriver[playerid]) == 1)
    {
       busdriver[playerid]= 0;
         SendClientMessage(playerid, COLOR_RED, \"You left your Busbehind, get in again if you want to continue your job.\");
    }else if((busdriver[playerid]) == 0){
        //Nothing
 }
}
public OnPlayerDeath(playerid, killerid, reason)
{
     DisablePlayerCheckpoint(playerid);
     busdriver[playerid] = 0;
     return 1;
}[/pawn]

Nem elérhető Dead

  • 2045
    • Profil megtekintése
Buszos Munka
« Válasz #1 Dátum: 2011. október 19. - 16:18:49 »
0 Show voters
LOL
Bocs nemtok segíteni mert nekemis kifagy xD
valameik függvény vagy változó vagy nemtom, nem illik bele a scriptbe
azért fagy ki a pawno :)

Buszos Munka
« Válasz #2 Dátum: 2011. október 19. - 16:22:07 »
0 Show voters
pedig nagyon kellene  :\'(

Buszos Munka
« Válasz #3 Dátum: 2011. október 19. - 21:19:49 »
0 Show voters
Normális hogy befagyik neked nekem is mert nincsen megadva a bussz id .. 3 tipusú  busz ID van azt a Bus1 Bus2 Bus3 helyetesisd be és a new bus1; írd átt a a busz ID -re :-*

Buszos Munka
« Válasz #4 Dátum: 2011. október 20. - 06:07:30 »
0 Show voters
Sehogy sem jó

Buszos Munka
« Válasz #5 Dátum: 2011. október 21. - 10:47:08 »
0 Show voters
Szörnyû ez a sok copy paste és fõleg az indentáció egyszerûen nem lehet átlátni a dolgokat mi miért van, próbálj megjegyzéseket tenni és elválasztó vonalakat az egyes funkciók köz-t/é, lásd is amit írsz ne mosódjon össze az egész.
[pawn]#include <a_samp>
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define   YELLOW 0xFFFF00AA
#define LIME 0x00FF00FF
#define PRESSED(%0) \\
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define HOLDING(%0) \\
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \\
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define buspoint1 -1998.7400,174.6382,27.6473
#define buspoint2 -1805.8813,600.1848,34.8620
#define buspoint3 -1601.1205,726.2743,11.1720
#define buspoint4 -1612.7714,857.1121,7.6761
#define buspoint5 -1766.0300,935.1175,24.8755
#define buspoint6 -1904.0560,811.3516,36.1556
#define buspoint7 -2648.9529,570.7150,14.5943
#define buspoint8 -2614.7012,215.6137,5.2519
#define buspoint9 -2150.6584,148.2724,35.3053
#define buspoint10 -2061.5159,-74.0719,34.8552
new IsBusJob[MAX_PLAYERS];
new bus1;
new bus2;
new bus3;
new busdriver[MAX_PLAYERS];
//--------------------------------------------------------------------------------------------------
public
OnFilterScriptInit()
{
bus1 = AddStaticVehicle(431,-1988.7975,192.1375,27.6358,359.7323,75,59); // bus1
bus2 =   AddStaticVehicle(431,-1988.8607,178.5440,27.6378,359.7324,75,59); // bus2
bus3 =   AddStaticVehicle(431,-1988.9200,165.7481,27.6426,359.7370,75,59); // bus3
return 1;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerCommandText(playerid, cmdtext[ ])
{
    if(strcmp(\"/start\", cmdtext, true) == 0)
    {
   new
      veh = GetPlayerVehicleID(playerid);
   if(veh == bus3 || veh == bus2 || veh == bus1)
   {
      busdriver[playerid] = 1;
      SetPlayerCheckpoint(playerid, buspoint1, 3.0);
      GameTextForPlayer(playerid, \"~g~Bus Driver Started!\", 3000, 3);
      new name[MAX_PLAYER_NAME], string[48];
      GetPlayerName(playerid, name, sizeof(name));
      format(string, sizeof(string), \"%s Is Now A Bus Driver!.\", name );
      SendClientMessageToAll(COLOR_RED, string);
      return 1;
   }
   SendClientMessage(playerid, COLOR_RED,\"You have to be in a bus to start the job\");
}
if (strcmp(\"/busdriverinfo\", cmdtext, true, 10) == 0)
{
   SendClientMessage(playerid, COLOR_YELLOW, \".\");
   SendClientMessage(playerid, COLOR_YELLOW, \".\");
   SendClientMessage(playerid, COLOR_YELLOW, \".\");
   SendClientMessage(playerid, COLOR_YELLOW, \"!\");
   return 1;
}
return 0;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
   busdriver[playerid] = 0;
}
return 1;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new
   veh = GetPlayerVehicleID(playerid);
if(veh == bus3 || veh == bus2 || veh == bus1)
{
   if(newkeys==KEY_SUBMISSION && IsBusJob[playerid] == 0 && veh == bus1 || veh == bus3 || veh == bus2) // checks if Submission key is pressed + if the player is already working + that the player is in a bus
   {
      SendClientMessage(playerid, LIME, \"You started working for the bus company!\"); // SCM only one time cause the variable under here.
      IsBusJob[playerid] = 1; // here&#039;s the variable set to 1, this will prevent the player from starting working over again.
      busdriver[playerid] = 1;
      SetPlayerCheckpoint(playerid, buspoint1, 3.0);
      GameTextForPlayer(playerid, \"~g~Bus Driver Started!\", 3000, 3);
      new name[MAX_PLAYER_NAME], string[48];
      GetPlayerName(playerid, name, sizeof(name));
      format(string, sizeof(string), \"%s Is Now A Bus Driver!.\", name );
      SendClientMessageToAll(LIME, string);
      SendClientMessage(playerid, COLOR_RED,\"You Have To Be In A Bus To Start The Mission!\");
   }
}
return 1;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerEnterCheckpoint(playerid)
{
new
   veh = GetPlayerVehicleID(playerid);
if(veh == bus3 || veh == bus2 || veh == bus1)
{
   if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint1))
   {
      SetPlayerCheckpoint(playerid, buspoint2, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The San Fierro Train Station, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint2))
   {
      SetPlayerCheckpoint(playerid, buspoint3, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The Cluckin Bell, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint3))
   {
      SetPlayerCheckpoint(playerid, buspoint4, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The Police Station, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint4))
   {
      SetPlayerCheckpoint(playerid, buspoint5, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The San Fierro Bank, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint5))
   {
      SetPlayerCheckpoint(playerid, buspoint6, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The Burger Shot, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if (IsPlayerInRangeOfPoint(playerid, 7.0,buspoint6))
   {
      SetPlayerCheckpoint(playerid, buspoint7, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At Ammunation, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint7))
   {
      SetPlayerCheckpoint(playerid, buspoint8, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The , Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint8))
   {
      SetPlayerCheckpoint(playerid, buspoint9, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At , Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint9))
   {
      SetPlayerCheckpoint(playerid, buspoint10, 7.0);
      SendClientMessage(playerid, LIME,\"Arrived At The Don&#039;s RubberShop, Received 500$\");
      GivePlayerMoney(playerid, 500);
   }
   else if(IsPlayerInRangeOfPoint(playerid, 7.0,buspoint10))
   {
      SendClientMessage(playerid, LIME,\"Type /Start Again To Start The BusDriver Mission!\");
      GivePlayerMoney(playerid, 500);
      DisablePlayerCheckpoint(playerid);
      busdriver[playerid] = 0;
   }
}
return 1;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
   if(vehicleid == bus3 || vehicleid == bus2 || vehicleid == bus1)
   {
      SendClientMessage(playerid, YELLOW, \"START THE BUS MISSION BY PRESSING 2\");
      GameTextForPlayer(playerid, \"~y~START THE BUS DRIVER MISSION BY~n~~b~PRESSING 2!\",3000,3);
   }
}
return 1;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerExitVehicle(playerid, vehicleid)
{
    if(busdriver[playerid] == 1)
    {
       busdriver[playerid]= 0;
         SendClientMessage(playerid, COLOR_RED, \"You left your Busbehind, get in again if you want to continue your job.\");
    }
else if(busdriver[playerid] == 0)
{
        //Nothing
}
return 1;
}
//--------------------------------------------------------------------------------------------------
public
OnPlayerDeath(playerid, killerid, reason)
{
     DisablePlayerCheckpoint(playerid);
     busdriver[playerid] = 0;
     return 1;
}[/pawn]

Buszos Munka
« Válasz #6 Dátum: 2011. október 21. - 12:36:00 »
0 Show voters
Köszi
Témát zárom

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal