GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Szkript kérések => A témát indította: ZSOLTI99 - 2013. augusztus 14. - 18:34:19

Cím: Irányjelzõ
Írta: ZSOLTI99 - 2013. augusztus 14. - 18:34:19
Hali. Kellene nekem egy olyan irányjelzõ ami nem oldalt van hanem a kocsinak a lámpájába ami világít mindig arra gondolnék és ha én meg nyomom a e q gombot akkor indexel jobbra balra.
Köszönöm a segítséget.
Cím: Irányjelzõ
Írta: Peter1481048284 - 2013. augusztus 14. - 18:38:11
http://sampforum.hu/index.php?topic=20101.0
[mod]
Elõször is, olvasd el a szabályzatot, mert még mindig nem tetted meg. Nem kell odaírni, hogy google. :) Másodszor ez a 7 pecsétes dolog nem vicces. :(
[/mod]
Cím: Irányjelzõ
Írta: ZSOLTI99 - 2013. augusztus 14. - 19:28:52
Kösz de nem ez kell ilyen nekem is van tudod van a lámpa és ott villogjon ne mellette mer ez így nem jó
Cím: Irányjelzõ
Írta: Benike1997 - 2013. augusztus 14. - 22:12:23
tehát, ha jól értelmezem, akkor olyan, ami a lámpa egyik oldalát villogtatja nem mellette egy sárga cucc villok?
Cím: Irányjelzõ
Írta: ZSOLTI99 - 2013. augusztus 14. - 23:01:03
ja az kell ami a lámpába van annyi elég
Cím: Irányjelzõ
Írta: Ryan_Adam - 2013. augusztus 18. - 14:42:12
#include <a_samp>
#define BLINK_RATE     400
#define PFLASH_RATE     300
#define LIGHT_KEY      KEY_SUBMISSION
#undef MAX_PLAYERS
#define MAX_PLAYERS 50
#define PRESSED(%0) \\
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new BlinkTime[MAX_PLAYERS];
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(BlinkTime[playerid]);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new panels, doors, lights, tires;
new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, panels, doors, lights, tires);
lights = encode_lights(1, 1, 1, 1);
SetPVarInt(playerid, \"vMainOn\", 0);
UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
KillTimer(BlinkTime[playerid]);
SetPVarInt(playerid, \"CopFlash\", 0);
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(LIGHT_KEY))
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
{
   if(GetPVarInt(playerid, \"CopFlash\") == 0)
   {
       new panels, doors, lights, tires;
       new carid = GetPlayerVehicleID(playerid);
      GetVehicleDamageStatus(carid, panels, doors, lights, tires);
      switch(GetPVarInt(playerid, \"vMainOn\"))
      {
          case 0:{
              lights = encode_lights(0, 0, 0, 0);
               SetPVarInt(playerid, \"vMainOn\", 1);
         }
         case 1:{
            lights = encode_lights(1, 1, 1, 1);
            SetPVarInt(playerid, \"vMainOn\", 0);
         }
      }
      UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
   }
}
}
if(PRESSED(KEY_CROUCH))
{
    if(IsPublicService(GetPlayerVehicleID(playerid)) && GetPlayerVehicleSeat(playerid) == 0)
{
   switch(GetPVarInt(playerid, \"CopFlash\"))
   {
      case 0:{
          KillTimer(BlinkTime[playerid]);
         BlinkTime[playerid] = SetTimerEx(\"vBlinker\", PFLASH_RATE, 1, \"i\", playerid);
         SetPVarInt(playerid, \"CopFlash\", 1);
      }
      case 1:{
            KillTimer(BlinkTime[playerid]);
                  new panels, doors, lights, tires;
                  new carid = GetPlayerVehicleID(playerid);
         GetVehicleDamageStatus(carid, panels, doors, lights, tires);
         lights = encode_lights(1, 1, 1, 1);
         UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
         SetPVarInt(playerid, \"CopFlash\", 0);
      }
   }
}
}
if(PRESSED(KEY_LOOK_LEFT))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
   if(GetPVarInt(playerid, \"vBLeft\") == 0)
   {
      new lights;
      KillTimer(BlinkTime[playerid]);
      BlinkTime[playerid] = SetTimerEx(\"vBlinker\", BLINK_RATE, 1, \"i\", playerid);
              lights = encode_lights(1, 1, 1, 1);
         SetPVarInt(playerid, \"vBLeft\", 1);
            SetPVarInt(playerid, \"vBRight\", 0);
   }else{
       KillTimer(BlinkTime[playerid]);
      new panels, doors, lights, tires;
      new carid = GetPlayerVehicleID(playerid);
      GetVehicleDamageStatus(carid, panels, doors, lights, tires);
       switch(GetPVarInt(playerid, \"vMainOn\")){
           case 0:{
              lights = encode_lights(1, 1, 1, 1);
         }
         case 1:{
                    lights = encode_lights(0, 0, 0, 0);
         }
      }
      UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
                    lights = encode_lights(0, 0, 0, 0);
      SetPVarInt(playerid, \"vBLeft\", 0);
   }
}
}
if(PRESSED(KEY_LOOK_RIGHT))
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
   if(GetPVarInt(playerid, \"vBRight\") == 0)
   {
      new lights;
      KillTimer(BlinkTime[playerid]);
      BlinkTime[playerid] = SetTimerEx(\"vBlinker\", BLINK_RATE, 1, \"i\", playerid);
            SetPVarInt(playerid, \"vBRight\", 1);
              lights = encode_lights(1, 1, 1, 1);
                    lights = encode_lights(0, 0, 0, 0);
         SetPVarInt(playerid, \"vBLeft\", 0);
   }else{
       KillTimer(BlinkTime[playerid]);
      new panels, doors, lights, tires;
      new carid = GetPlayerVehicleID(playerid);
      GetVehicleDamageStatus(carid, panels, doors, lights, tires);
       switch(GetPVarInt(playerid, \"vMainOn\")){
           case 0:{
              lights = encode_lights(1, 1, 1, 1);
         }
         case 1:{
                    lights = encode_lights(0, 0, 0, 0);
         }
      }
      UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
                    lights = encode_lights(0, 0, 0, 0);
      SetPVarInt(playerid, \"vBRight\", 0);
   }
}
}
return 1;
}
forward vBlinker(playerid);
public vBlinker(playerid)
{
if(IsPlayerInAnyVehicle(playerid) && GetPVarInt(playerid, \"CopFlash\") != 1)
{
    new Keys, ud, lr, panels, doors, lights, tires;
    new carid = GetPlayerVehicleID(playerid);
    GetPlayerKeys(playerid, Keys, ud, lr);
GetVehicleDamageStatus(carid, panels, doors, lights, tires);
if(lr > 0)
{
   if(GetPVarInt(playerid, \"vBLeft\") == 1)
   {
       KillTimer(BlinkTime[playerid]);
       switch(GetPVarInt(playerid, \"vMainOn\")){
           case 0:{
              lights = encode_lights(1, 1, 1, 1);
         }
         case 1:{
                    lights = encode_lights(0, 0, 0, 0);
         }
      }
      UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
       SetPVarInt(playerid, \"vBLeft\", 0);
       return 1;
   }
}
else if(lr < 0)
{
   if(GetPVarInt(playerid, \"vBRight\") == 1)
   {
       KillTimer(BlinkTime[playerid]);
       switch(GetPVarInt(playerid, \"vMainOn\")){
           case 0:{
              lights = encode_lights(1, 1, 1, 1);
         }
         case 1:{
                    lights = encode_lights(0, 0, 0, 0);
         }
      }
      UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
       SetPVarInt(playerid, \"vBRight\", 0);
       return 1;
   }
}
if(GetPVarInt(playerid, \"vBRight\") == 1)
{
   switch(GetPVarInt(playerid, \"vMainOn\")){
       case 0:{
               switch(GetPVarInt(playerid, \"vBlinkOn\")){
                   case 0:{
                 lights = encode_lights(1, 1, 0, 0);
                     SetPVarInt(playerid, \"vBlinkOn\", 1);
                   }
                   case 1:{
               lights = encode_lights(1, 1, 1, 1);
               SetPVarInt(playerid, \"vBlinkOn\", 0);
                   }
         }
      }
      case 1:{
                  switch(GetPVarInt(playerid, \"vBlinkOn\")){
                   case 0:{
                 lights = encode_lights(0, 0, 1, 1);
                     SetPVarInt(playerid, \"vBlinkOn\", 1);
                   }
                   case 1:{
               lights = encode_lights(0, 0, 0, 0);
               SetPVarInt(playerid, \"vBlinkOn\", 0);
                   }
         }
      }
   }
}
if(GetPVarInt(playerid, \"vBLeft\") == 1)
{
   switch(GetPVarInt(playerid, \"vMainOn\")){
       case 0:{
               switch(GetPVarInt(playerid, \"vBlinkOn\")){
                   case 0:{
                 lights = encode_lights(0, 0, 1, 1);
                     SetPVarInt(playerid, \"vBlinkOn\", 1);
                   }
                   case 1:{
               lights = encode_lights(1, 1, 1, 1);
               SetPVarInt(playerid, \"vBlinkOn\", 0);
                   }
         }
      }
      case 1:{
                  switch(GetPVarInt(playerid, \"vBlinkOn\")){
                   case 0:{
                 lights = encode_lights(1, 1, 0, 0);
                     SetPVarInt(playerid, \"vBlinkOn\", 1);
                   }
                   case 1:{
               lights = encode_lights(0, 0, 0, 0);
               SetPVarInt(playerid, \"vBlinkOn\", 0);
                   }
         }
      }
   }
}
UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
}
else if(GetPVarInt(playerid, \"CopFlash\") == 1)
{
    new d[4];
    new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, d[0], d[1], d[2], d[3]);
switch(GetPVarInt(playerid, \"vBlinkOn\"))
{
   case 0:{
      d[2] = encode_lights(1, 1, 0, 0);
      SetPVarInt(playerid, \"vBlinkOn\", 1);
   }
   case 1:{
      d[2] = encode_lights(0, 0, 1, 1);
      SetPVarInt(playerid, \"vBlinkOn\", 0);
   }
}
UpdateVehicleDamageStatus(carid, d[0], d[1], d[2], d[3]);
return 1;
}
return 1;
}
encode_lights(light1, light2, light3, light4) {
return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
IsPublicService(carid)
{
    new PS[11] = { 416, 427, 490, 528, 407, 544, 596, 598, 597, 599, 601 };
    for(new i = 0; i < sizeof(PS); i++)
{
if(GetVehicleModel(carid) == PS) return 1;
}
return 0;
}
Cím: Irányjelzõ
Írta: ZSOLTI99 - 2013. augusztus 18. - 18:54:14
Köszi a segítséget és mûködik is ? Mer nem tudom tesztelni nem jó a samp a héten a gépet újra fogom rakni vagy valamikor és akkor lesz jó ha jó lesz egyáltalán