Szerző Téma: Tank Lights System  (Megtekintve 1313 alkalommal)

Nem elérhető pisti525

  • 906
  • One Shot, One Kill
    • Profil megtekintése
Tank Lights System
« Dátum: 2013. március 15. - 00:03:34 »
+1 Show voters
Sziasztok!
Átszeretnék hozni egy scriptet neve : Tank Lights System
Készítõ : OKStyle
\"tank_lights_01.png\"
\"tank_lights_02.png\"
\"tank_lights_03.png\"
Ugye bárt már a képekbõl is kilehet venni hogy ez a script azt tudja hogy a tanknak (Rhino) kék színû lámát add.
Parancsok:
- /tlon - Lámpa bekapcsolása
- /tloff - Lámpa kikapcsolása
 
#include <a_samp>
// Tank Light System by O.K.Style™
#define TANK_LIGHTS_SYNC_DELAY 30 * 1000
new TankTimer[MAX_PLAYERS char], tank[3], tlight[6];
public OnFilterScriptInit()
{
tank[0] = CreateVehicle(432, 277.0, 1998.2, 17.65, 270.0, 43, 0, -1);
tank[1] = CreateVehicle(432, 277.0, 1989.2, 17.65, 269.0, 43, 0, -1);
tank[2] = CreateVehicle(432, 277.0, 1980.2, 17.65, 270.0, 43, 0, -1);
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < sizeof(tank); i++) DestroyVehicle(tank);
for(new i = 0; i < sizeof(tlight); i++) if(IsValidObject(tlight)) DestroyObject(tlight);
for(new i = GetMaxPlayers() - 1; i != -1; i--) KillTimer(TankTimer{i});
return 1;
}
public OnPlayerConnect(playerid) return TogglePlayerClock(playerid, 1);
public OnPlayerDisconnect(playerid, reason) return KillTimer(TankTimer{playerid});
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPVarInt(playerid, \"TLOff\") == 1) return 1;
if(newstate == PLAYER_STATE_DRIVER)
{
    for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   new hour, minute;
   GetPlayerTime(playerid, hour, minute);
   #pragma unused minute
   if(hour < 6 || hour > 21)
   {
      switch(i)
      {
         case 0:
         {
             for(new k = 0; k < 2; k++) tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(tlight[0], tank[0], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
            AttachObjectToVehicle(tlight[1], tank[0], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         }
         case 1:
         {
             for(new k = 2; k < 4; k++) tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(tlight[2], tank[1], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
            AttachObjectToVehicle(tlight[3], tank[1], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         }
         case 2:
         {
             for(new k = 4; k < 6; k++) tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(tlight[4], tank[2], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
            AttachObjectToVehicle(tlight[5], tank[2], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         }
         default: return 1;
      }
      TankTimer{playerid} = SetTimerEx(\"CheckTank\", TANK_LIGHTS_SYNC_DELAY, 1, \"ii\", playerid, tank);
   }
   break;
}
}
if(oldstate == PLAYER_STATE_DRIVER && newstate != PLAYER_STATE_DRIVER)
{
for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   switch(i)
   {
      case 0: for(new k = 0; k < 2; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 1: for(new k = 2; k < 4; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 2: for(new k = 4; k < 6; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      default: return 1;
   }
   KillTimer(TankTimer{playerid});
   break;
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, \"/tloff\", true) == 0)
{
for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   switch(i)
   {
      case 0: for(new k = 0; k < 2; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 1: for(new k = 2; k < 4; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 2: for(new k = 4; k < 6; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      default: return 1;
   }
   KillTimer(TankTimer{playerid});
   SetPVarInt(playerid, \"TLOff\", 1);
   break;
}
    return 1;
}
if(strcmp(cmdtext, \"/tlon\", true) == 0)
{
for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   switch(i)
   {
      case 0:
      {
          for(new k = 0; k < 2; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[0], tank[0], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[1], tank[0], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 1:
      {
          for(new k = 2; k < 4; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[2], tank[1], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[3], tank[1], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 2:
      {
          for(new k = 4; k < 6; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[4], tank[2], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[5], tank[2], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      default: return 1;
   }
   DeletePVar(playerid, \"TLOff\");
   break;
}
    return 1;
}
return 0;
}
forward CheckTank(playerid, vehicleid);
public CheckTank(playerid, vehicleid)
{
    if(GetPVarInt(playerid, \"TLOff\") == 1) return 1;
    for(new i = 0; i < sizeof(tank); i++)
{
if(!IsPlayerInVehicle(playerid, tank)) continue;
new hour, minute;
GetPlayerTime(playerid, hour, minute);
#pragma unused minute
if(hour > 5 && hour < 22)
{
   switch(i)
   {
      case 0: for(new k = 0; k < 2; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 1: for(new k = 2; k < 4; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 2: for(new k = 4; k < 6; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      default: return 1;
   }
}
else
{
   switch(i)
   {
      case 0:
      {
          for(new k = 0; k < 2; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[0], tank[0], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[1], tank[0], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 1:
      {
          for(new k = 2; k < 4; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[2], tank[1], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[3], tank[1], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 2:
      {
          for(new k = 4; k < 6; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[4], tank[2], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[5], tank[2], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      default: return 1;
   }
}
}
return 1;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \')) index++;
new offset = index, result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1))) result[index - offset] = string[index], index++;
result[index - offset] = EOS;
return result;
}

 
Egy kicsikét bele szerkesztettem mert volt egy /time parancs amivel az összes játékos idejét lehetett volna állítani  :D + fölöslegesnek találtam
Használjátok egészséggel! :)
« Utoljára szerkesztve: 2013. március 15. - 00:05:12 írta pisti525 »

Nem elérhető BackUP

  • 908
    • Profil megtekintése
Tank Lights System
« Válasz #1 Dátum: 2013. március 16. - 21:22:36 »
+1 Show voters
Nagyon tetszik, de nem lámát, hanem lámpát add neki. :D

Tank Lights System
« Válasz #2 Dátum: 2013. március 16. - 22:09:13 »
0 Show voters
Idézetet írta: pisti525 date=1363302214\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"34889\" data-ipsquote-contentclass=\"forums_Topic
Sziasztok!
Átszeretnék hozni egy scriptet neve : Tank Lights System
Készítõ : OKStyle
\"tank_lights_01.png\"
\"tank_lights_02.png\"
\"tank_lights_03.png\"
Ugye bárt már a képekbõl is kilehet venni hogy ez a script azt tudja hogy a tanknak (Rhino) kék színû lámát add.
Parancsok:
- /tlon - Lámpa bekapcsolása
- /tloff - Lámpa kikapcsolása
 
#include <a_samp>
// Tank Light System by O.K.Style™
#define TANK_LIGHTS_SYNC_DELAY 30 * 1000
new TankTimer[MAX_PLAYERS char], tank[3], tlight[6];
public OnFilterScriptInit()
{
tank[0] = CreateVehicle(432, 277.0, 1998.2, 17.65, 270.0, 43, 0, -1);
tank[1] = CreateVehicle(432, 277.0, 1989.2, 17.65, 269.0, 43, 0, -1);
tank[2] = CreateVehicle(432, 277.0, 1980.2, 17.65, 270.0, 43, 0, -1);
return 1;
}
public OnFilterScriptExit()
{
for(new i = 0; i < sizeof(tank); i++) DestroyVehicle(tank);
for(new i = 0; i < sizeof(tlight); i++) if(IsValidObject(tlight)) DestroyObject(tlight);
for(new i = GetMaxPlayers() - 1; i != -1; i--) KillTimer(TankTimer{i});
return 1;
}
public OnPlayerConnect(playerid) return TogglePlayerClock(playerid, 1);
public OnPlayerDisconnect(playerid, reason) return KillTimer(TankTimer{playerid});
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPVarInt(playerid, \"TLOff\") == 1) return 1;
if(newstate == PLAYER_STATE_DRIVER)
{
    for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   new hour, minute;
   GetPlayerTime(playerid, hour, minute);
   #pragma unused minute
   if(hour < 6 || hour > 21)
   {
      switch(i)
      {
         case 0:
         {
             for(new k = 0; k < 2; k++) tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(tlight[0], tank[0], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
            AttachObjectToVehicle(tlight[1], tank[0], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         }
         case 1:
         {
             for(new k = 2; k < 4; k++) tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(tlight[2], tank[1], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
            AttachObjectToVehicle(tlight[3], tank[1], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         }
         case 2:
         {
             for(new k = 4; k < 6; k++) tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            AttachObjectToVehicle(tlight[4], tank[2], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
            AttachObjectToVehicle(tlight[5], tank[2], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         }
         default: return 1;
      }
      TankTimer{playerid} = SetTimerEx(\"CheckTank\", TANK_LIGHTS_SYNC_DELAY, 1, \"ii\", playerid, tank);
   }
   break;
}
}
if(oldstate == PLAYER_STATE_DRIVER && newstate != PLAYER_STATE_DRIVER)
{
for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   switch(i)
   {
      case 0: for(new k = 0; k < 2; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 1: for(new k = 2; k < 4; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 2: for(new k = 4; k < 6; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      default: return 1;
   }
   KillTimer(TankTimer{playerid});
   break;
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, \"/tloff\", true) == 0)
{
for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   switch(i)
   {
      case 0: for(new k = 0; k < 2; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 1: for(new k = 2; k < 4; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 2: for(new k = 4; k < 6; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      default: return 1;
   }
   KillTimer(TankTimer{playerid});
   SetPVarInt(playerid, \"TLOff\", 1);
   break;
}
    return 1;
}
if(strcmp(cmdtext, \"/tlon\", true) == 0)
{
for(new i = 0; i < sizeof(tank); i++)
{
   if(!IsPlayerInVehicle(playerid, tank)) continue;
   switch(i)
   {
      case 0:
      {
          for(new k = 0; k < 2; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[0], tank[0], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[1], tank[0], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 1:
      {
          for(new k = 2; k < 4; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[2], tank[1], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[3], tank[1], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 2:
      {
          for(new k = 4; k < 6; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[4], tank[2], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[5], tank[2], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      default: return 1;
   }
   DeletePVar(playerid, \"TLOff\");
   break;
}
    return 1;
}
return 0;
}
forward CheckTank(playerid, vehicleid);
public CheckTank(playerid, vehicleid)
{
    if(GetPVarInt(playerid, \"TLOff\") == 1) return 1;
    for(new i = 0; i < sizeof(tank); i++)
{
if(!IsPlayerInVehicle(playerid, tank)) continue;
new hour, minute;
GetPlayerTime(playerid, hour, minute);
#pragma unused minute
if(hour > 5 && hour < 22)
{
   switch(i)
   {
      case 0: for(new k = 0; k < 2; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 1: for(new k = 2; k < 4; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      case 2: for(new k = 4; k < 6; k++) if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
      default: return 1;
   }
}
else
{
   switch(i)
   {
      case 0:
      {
          for(new k = 0; k < 2; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[0], tank[0], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[1], tank[0], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 1:
      {
          for(new k = 2; k < 4; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[2], tank[1], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[3], tank[1], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      case 2:
      {
          for(new k = 4; k < 6; k++)
         {
            if(IsValidObject(tlight[k])) DestroyObject(tlight[k]);
            tlight[k] = CreateObject(19280, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
         }
         AttachObjectToVehicle(tlight[4], tank[2], 1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
         AttachObjectToVehicle(tlight[5], tank[2], -1.6, 3.83, 0.675, 15.075, 0.0, 0.0);
      }
      default: return 1;
   }
}
}
return 1;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \')) index++;
new offset = index, result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1))) result[index - offset] = string[index], index++;
result[index - offset] = EOS;
return result;
}

 
Egy kicsikét bele szerkesztettem mert volt egy /time parancs amivel az összes játékos idejét lehetett volna állítani  :D + fölöslegesnek találtam
Használjátok egészséggel! :)
 
Na :D Ez jó :)

Tank Lights System
« Válasz #3 Dátum: 2013. március 17. - 09:29:09 »
0 Show voters
Na ez kell nekem!! KÖSZIII  :thumbsup:

Nem elérhető pisti525

  • 906
  • One Shot, One Kill
    • Profil megtekintése
Tank Lights System
« Válasz #4 Dátum: 2013. március 17. - 16:54:35 »
0 Show voters
Nincsmit! :)

Nem elérhető Amf

  • 1459
    • Profil megtekintése
Tank Lights System
« Válasz #5 Dátum: 2013. március 17. - 17:23:47 »
0 Show voters
Egyik nap láttam a hiv. fórumon.. már vártam, hogy mikor hozzák át..  :wall:

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal