Szerző Téma: Caravan Script  (Megtekintve 1590 alkalommal)

Nem elérhető instant

  • 2778
  • ZzzzzZ
    • Profil megtekintése
Caravan Script
« Dátum: 2012. Január 23. - 22:11:23 »
+3 Show voters
Üdv áthoztam 1 scriptet a HIV.FÓRUMRÓL .
Készitõ:[PC]henkie[NL]
Szükséges Include Hozzá még :http://forum.sa-mp.com/showthread.php?t=175565
Eredeti Link:http://forum.sa-mp.com/showthread.php?t=299761
Képek:
Nappal:
\"samp000nby.png\"
Este:
\"samp001kv.png\"
Script:
[pawn]//=============================================================================
//                     CARAVAN SCRIPT BY HENK ©2011
//                      DO NOT REMOVE THIS CREDITS!
//=============================================================================
//                  ONLY EDIT THIS PART OF THE SCRIPT
#define SMALL_CARAVAN_PRICE 15000   //Changes the price for a small caravan.
#define BIG_CARAVAN_PRICE 20000     //Changes the price for a big caravan.
#define DEALER_XPOS 1687.0305       //Changes the dealership x-pos
#define DEALER_YPOS 1855.0242       //Changes the dealership y-pos
#define DEALER_ZPOS 10.6638         //Changes the dealership z-pos
//                         END OF THE EDIT PART
//=============================================================================
//Includes
#include <a_samp>
#include <YSI\\y_ini>
//=============================================================================
//Defines
#define DIALOG_BUYC 70
#define DIALOG_CONFIRMC 71
#define PATH \"Caravans/%s.ini\"
#define COLOR_RED 0xFF0000FF
//=============================================================================
//Forwards
forward LoadCaravans_data(playerid, name[], value[]);
//=============================================================================
//Vars
new Caravan[MAX_PLAYERS];
new CaravanChoise[MAX_PLAYERS];
new vehicleid;
enum cInfo
{
cModel,
Float:cXpos,
Float:cYpos,
Float:cZpos,
Float:cRotation,
cOwner[64],
cAmount
}
new CaravanInfo[MAX_PLAYERS][cInfo];
//=============================================================================
public OnFilterScriptInit()
{
CreatePickup(1318, 0, DEALER_XPOS, DEALER_YPOS, DEALER_ZPOS, -1);
   
print(\"\\n======================================\");
print(\"|     Caravan Script 3.2 by Henk     |\");
print(\"======================================\\n\");
return 1;
}
//=============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(\"/attach\", cmdtext, true, 10) == 0)
{
    new Float:pos[3];
    GetVehiclePos(GetPlayerVehicleID(playerid), pos[0], pos[1], pos[2]);
   vehicleid = GetPlayerVehicleID(playerid);
   new model = GetVehicleModel(vehicleid);
   if( model== 592 || model== 577 || model== 511 || model== 512 || model== 593 || model== 520 || model== 553 || model== 476 || model== 519 || model== 460
    || model== 513 || model== 548 || model== 425 || model== 417 || model== 487 || model== 488 || model== 497 || model== 563 || model== 447
        || model== 469 || model== 509 || model== 481 || model== 510 || model== 462 || model== 448 || model== 581 || model== 522 || model== 461
     || model== 521 || model== 523 || model== 463 || model== 586 || model== 468 || model== 471 || model== 472 || model== 473 || model== 493
         || model== 595 || model== 484 || model== 430 || model== 453 || model== 452 || model== 446 || model== 454 )
   {
       SendClientMessage(playerid, COLOR_RED, \"Nem tudsz erre a jármüre karavánt rakni!!\");
   }
   else
   {
      if(CaravanInfo[playerid][cModel] == 3172)
      {
         if(IsPlayerInRangeOfPoint(playerid, 25.0, CaravanInfo[playerid][cXpos], CaravanInfo[playerid][cYpos], CaravanInfo[playerid][cZpos]))
         {
            AttachObjectToVehicle(Caravan[playerid], vehicleid, 0.0, -8.7, -0.8, 0.0, 0.0, 180);
         }
      }
      else
      {
         if(IsPlayerInRangeOfPoint(playerid, 25.0, CaravanInfo[playerid][cXpos], CaravanInfo[playerid][cYpos], CaravanInfo[playerid][cZpos]))
         {
            AttachObjectToVehicle(Caravan[playerid], vehicleid, 0.0, -7.2, -0.8, 0.0, 0.0, 180);
         }
      }
        }
   return 1;
}
else if(strcmp(\"/detach\", cmdtext, true, 10) == 0)
{
    new Float:pos[4];
   GetVehiclePos(GetPlayerVehicleID(playerid), pos[0], pos[1], pos[2]);
   GetVehicleZAngle(GetPlayerVehicleID(playerid), pos[3]);
   if(CaravanInfo[playerid][cModel] == 3172)
   {
      pos[1]=pos[1]-8.7;
      pos[2]=pos[2]-0.8;
   }
   else if(CaravanInfo[playerid][cModel] == 3171)
   {
      pos[1]=pos[1]-7.2;
      pos[2]=pos[2]-0.8;
   }
   CaravanInfo[playerid][cXpos] = pos[0];
   CaravanInfo[playerid][cYpos] = pos[1];
   CaravanInfo[playerid][cZpos] = pos[2];
   CaravanInfo[playerid][cRotation] = -pos[3];
    new INI:File = INI_Open(UserPath(playerid));
   INI_SetTag(File,\"data\");
   INI_WriteInt(File,\"Model\", CaravanInfo[playerid][cModel]);
   INI_WriteFloat(File,\"Xpos\",pos[0]);
   INI_WriteFloat(File,\"Ypos\", pos[1]);
   INI_WriteFloat(File,\"Zpos\", pos[2]);
   INI_WriteFloat(File,\"Rotation\", CaravanInfo[playerid][cRotation]);
   INI_WriteString(File,\"Owner\", CaravanInfo[playerid][cOwner]);
   INI_WriteInt(File,\"Amount\", CaravanInfo[playerid][cAmount]);
   INI_Close(File);
   INI_Close(File);
    DestroyObject(Caravan[playerid]);
   Caravan[playerid] = CreateObject(
            CaravanInfo[playerid][cModel],
                pos[0],
                pos[1],
                      pos[2],
            0.0,
                     0.0,
                      CaravanInfo[playerid][cRotation],
                      0.0
              );
    return 1;
}
else if(strcmp(\"/buy\", cmdtext, true, 10) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, DEALER_XPOS, DEALER_YPOS, DEALER_ZPOS))
    {
            if(fexist(UserPath(playerid)))
       {
          SendClientMessage(playerid, COLOR_RED, \"Neked már van karavánod! Használd /sellcaravan hogy eladd.\");
      }
      else
      {
          ShowPlayerDialog(playerid, DIALOG_BUYC, DIALOG_STYLE_LIST, \"Caravan Dealer\", \"Kicsi Caravan\\n Nagy Caravan\", \"Choose\", \"Cancel\");
      }
   }
    else
    {
        SendClientMessage(playerid, COLOR_RED, \"Nem vagy a caraván eladónál!\");
   }
   return 1;
}
else if(strcmp(\"/sellcaravan\", cmdtext, true, 10) == 0)
{
   if(fexist(UserPath(playerid)))
   {
       DestroyObject(Caravan[playerid]);
          fremove(UserPath(playerid));
   }
   else
   {
          SendClientMessage(playerid,COLOR_RED, \"Nincs Karavánod hogy eladd!\");
   }
    return 1;
}
return 0;
}
//=============================================================================
public LoadCaravans_data(playerid, name[], value[])
{
INI_Int(\"Model\",CaravanInfo[playerid][cModel]);
INI_Float(\"Xpos\",CaravanInfo[playerid][cXpos]);
INI_Float(\"Ypos\",CaravanInfo[playerid][cYpos]);
INI_Float(\"Zpos\",CaravanInfo[playerid][cZpos]);
INI_Float(\"Rotation\",CaravanInfo[playerid][cRotation]);
INI_String(\"Owner\",CaravanInfo[playerid][cOwner], 64);
INI_Int(\"Amount\",CaravanInfo[playerid][cAmount]);
Caravan[playerid] = CreateObject(
            CaravanInfo[playerid][cModel],
                CaravanInfo[playerid][cXpos],
                CaravanInfo[playerid][cYpos],
                      CaravanInfo[playerid][cZpos],
            0.0,
                     0.0,
                      CaravanInfo[playerid][cRotation],
                      0.0
              );
return 1;
}
//=============================================================================
stock LoadCaravan(playerid)
{
Caravan[playerid] = CreateObject(
    CaravanInfo[playerid][cModel],
    CaravanInfo[playerid][cXpos],
    CaravanInfo[playerid][cYpos],
    CaravanInfo[playerid][cZpos],
    0.0,
    0.0,
    CaravanInfo[playerid][cRotation],
    0.0
    );
return 1;
}
//=============================================================================
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
//=============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
    case 70:
    {
        ShowPlayerDialog(playerid, DIALOG_CONFIRMC, DIALOG_STYLE_MSGBOX, \"Confirm Deal\", \"Are you sure, you want to buy this caravan?\", \"Confirm\", \"Cancel\");
        if(listitem == 0)
        {
            CaravanChoise[playerid] = 0;
      }
      else if(listitem == 1)
      {
            CaravanChoise[playerid] = 1;
      }
    }
    case 71:
    {
      switch(response)
      {
          case 1:
          {
              if(CaravanChoise[playerid] == 0)
              {
                  if(GetPlayerMoney(playerid) > SMALL_CARAVAN_PRICE)
                  {
                  GivePlayerMoney(playerid, -SMALL_CARAVAN_PRICE);
                  new playername[64];
                  GetPlayerName(playerid, playername, sizeof playername);
                   new INI:File = INI_Open(UserPath(playerid));
                  INI_SetTag(File,\"data\");
                  INI_WriteInt(File,\"Model\", 3171);
                  INI_WriteFloat(File,\"Xpos\",DEALER_XPOS);
                  INI_WriteFloat(File,\"Ypos\",DEALER_YPOS);
                  INI_WriteFloat(File,\"Zpos\", DEALER_ZPOS);
                  INI_WriteFloat(File,\"Rotation\",180.0000);
                  INI_WriteString(File,\"Owner\", playername);
                  INI_WriteInt(File,\"Amount\", 1);
                  INI_Close(File);
                    INI_ParseFile(UserPath(playerid), \"LoadCaravans_%s\", .bExtra = true, .extra = playerid);
                    LoadCaravan(playerid);
               }
               else
               {
                   SendClientMessage(playerid, COLOR_RED, \"Nincs elég pénzed ehhez a karavánhoz!\");
               }
            }
            else if(CaravanChoise[playerid] == 1)
            {
                if(GetPlayerMoney(playerid) > BIG_CARAVAN_PRICE)
                {
                   GivePlayerMoney(playerid, -BIG_CARAVAN_PRICE);
                   new playername[64];
                  GetPlayerName(playerid, playername, sizeof playername);
                   new INI:File = INI_Open(UserPath(playerid));
                  INI_SetTag(File,\"data\");
                  INI_WriteInt(File,\"Model\", 3172);
                  INI_WriteFloat(File,\"Xpos\",DEALER_XPOS);
                  INI_WriteFloat(File,\"Ypos\",DEALER_YPOS);
                  INI_WriteFloat(File,\"Zpos\", DEALER_ZPOS);
                  INI_WriteFloat(File,\"Rotation\",180.0000);
                  INI_WriteString(File,\"Owner\", playername);
                  INI_WriteInt(File,\"Amount\", 1);
                  INI_Close(File);
                    INI_ParseFile(UserPath(playerid), \"LoadCaravans_%s\", .bExtra = true, .extra = playerid);
                    LoadCaravan(playerid);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, \"nincs elég pénzed ehhez a karavánhoz!\");
                    }
            }
          }
      }
    }
}
return 1;
}
//=============================================================================
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
        INI_ParseFile(UserPath(playerid), \"LoadCaravans_%s\", .bExtra = true, .extra = playerid);
        LoadCaravan(playerid);
}
return 1;
}
//=============================================================================
public OnPlayerDisconnect(playerid)
{
DestroyObject(Caravan[playerid]);
return 1;
}
//=============================================================================
//                      NOTE:    BIG CARAVAN ID: 3172
//                              SMALL CARAVAN ID: 3171
//=============================================================================[/pawn]
« Utoljára szerkesztve: 2012. Január 24. - 14:18:15 írta ZzzzzZ »

Nem elérhető Norby

  • 1575
    • Profil megtekintése
Caravan Script
« Válasz #1 Dátum: 2012. Január 24. - 07:19:01 »
0 Show voters
Nem rossz.
De te folyamatosan a hivatalos fórumról hozol át Scripteket. Ez igaz nincs tiltva, engedélyezett. De én még egyetlen egy nagyobb munkádat nem láttam még hogy csináltál volna.

Nem elérhető instant

  • 2778
  • ZzzzzZ
    • Profil megtekintése
Caravan Script
« Válasz #2 Dátum: 2012. Január 24. - 14:17:27 »
0 Show voters
Idézetet írta: Norby date=1327385941\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"16028\" data-ipsquote-contentclass=\"forums_Topic
Nem rossz.
De te folyamatosan a hivatalos fórumról hozol át Scripteket. Ez igaz nincs tiltva, engedélyezett. De én még egyetlen egy nagyobb munkádat nem láttam még hogy csináltál volna.
 
Lusta vagyok rá ;)

Dupla hozzászólás automatikusan összefûzve. ( 2012. Január 24. - 14:17:57 )

meg am is hanyagolom a sampot már valami jó játékot keresek

Caravan Script
« Válasz #3 Dátum: 2012. Január 25. - 13:48:16 »
0 Show voters
Fuuu... valami nem jó  ezt irja ki
 

 
C:\\Users\\win7\\Desktop\\Samp-Scriptek\\caravan.pwn(16) : fatal error 100: cannot read from file: \"\"
Compilation aborted.Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase
 
1 Error. 

Nem elérhető instant

  • 2778
  • ZzzzzZ
    • Profil megtekintése
Caravan Script
« Válasz #4 Dátum: 2012. Január 25. - 17:28:16 »
0 Show voters
include hiány ?? ez y_ini vel lett irva

Caravan Script
« Válasz #5 Dátum: 2012. Január 25. - 17:35:24 »
0 Show voters
Postal feeling. Raj.

Nem elérhető rhassi

  • 624
    • Profil megtekintése
Caravan Script
« Válasz #6 Dátum: 2012. Január 25. - 19:10:34 »
+1 Show voters
Ilyet már én is csináltam.. Az a baj vele, hogy érintkezik a kocsival és elrepül :\\
Ez csak egy sima attachvobject? Én olyat csináltam, hogy ráraktam az objectet egy adott kocsira, a kocsit interiorba (így csak az obj látszik) és azt a kocsit vontatta a player kocsija.
« Utoljára szerkesztve: 2012. Január 25. - 19:15:13 írta rhassi »

Nem elérhető JackBronson

  • 1499
  • ??
    • Profil megtekintése
Caravan Script
« Válasz #7 Dátum: 2012. Január 26. - 16:41:36 »
0 Show voters
Idézetet írta: rhassi date=1327515034\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"16028\" data-ipsquote-contentclass=\"forums_Topic
Ilyet már én is csináltam.. Az a baj vele, hogy érintkezik a kocsival és elrepül :\\
Ez csak egy sima attachvobject? Én olyat csináltam, hogy ráraktam az objectet egy adott kocsira, a kocsit interiorba (így csak az obj látszik) és azt a kocsit vontatta a player kocsija.
 
EZ jó ötlet erre nem is gondoltam :)
Kösz ezért jár egy + xD megpróbálom ezzel a motszerrel.
De ezzel az a baj,hogy másik int.

Nem elérhető rhassi

  • 624
    • Profil megtekintése
Caravan Script
« Válasz #8 Dátum: 2012. Január 26. - 16:43:35 »
0 Show voters
Idézetet írta: JaCk date=1327592496\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"16028\" data-ipsquote-contentclass=\"forums_Topic


Ilyet már én is csináltam.. Az a baj vele, hogy érintkezik a kocsival és elrepül :\\
Ez csak egy sima attachvobject? Én olyat csináltam, hogy ráraktam az objectet egy adott kocsira, a kocsit interiorba (így csak az obj látszik) és azt a kocsit vontatta a player kocsija.
 
EZ jó ötlet erre nem is gondoltam :)
Kösz ezért jár egy + xD megpróbálom ezzel a motszerrel.
De ezzel az a baj,hogy másik int.
 
[/quote]
Csak a vontatott kocsit rakd másik intibe. Kösz a pluszt :D
Core RPG-re bekerült volna egyébként, de a bugok lehetetlenné teszik a normális használatát.

Caravan Script
« Válasz #9 Dátum: 2012. Január 26. - 17:47:03 »
0 Show voters
Egész jól néz ki bár már találkoztam vele eredeti fórumon. De én is azt mondom, hogy kipróbáltam de lehetetlen bugmentesen megcsinálni dolgokat.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal