Oko spavnovanja auta

Započeo Wudy, Jun 20, 2019, 13:31:01 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): Imam problem na svom serveru da kada kupim auto, i npr relog ono mi se pojavi na kordinatama x0,y0,z0
Deo skripte:(ne znam tacno gde je problem ali evo OnPlayerConnect
[pawn]public OnPlayerConnect(playerid)
{
    SetTimerEx("RekordTimer", 10, false, "d", playerid);
    SendClientMessage(playerid, 0x2641FEAA, "[SG:RP] Ocitavanje Servera, Sacekajte malo. ");
    StopAudioStreamForPlayer(playerid);
    PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/gpem9hqdsb/RELJA_POPOVIC_-_LOM_OFFICIAL_VIDEO_.mp3");
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    SetPVarInt(playerid, "stvorioavozilo", 0);
   DeletePVar(playerid, "BoomboxObject"); DeletePVar(playerid, "BoomboxURL");
    DeletePVar(playerid, "bposX"); DeletePVar(playerid, "bposY"); DeletePVar(playerid, "bposZ"); DeletePVar(playerid, "bboxareaid");
    if(IsValidDynamicObject(GetPVarInt(playerid, "BoomboxObject"))) DestroyDynamicObject(GetPVarInt(playerid, "BoomboxObject"));
    new szFile[32], szLog[128], szIp[17], Year, Month, Day;
   getdate(Year, Month, Day);
   GetPlayerIp(playerid, szIp, charsmax(szIp));
   format(szFile, charsmax(szFile), "logoviipadresa/IP Log_%02d%02d%d.log", Day, Month, Year);
   format(szLog, charsmax(szLog), "Ime Igraca: %s | IP: %s", GetName(playerid), szIp);
   Log(szFile, szLog);

   static country[50];
   GetPlayerCountry(playerid, country, sizeof(country));

   new str[150];
   format(str, sizeof(str), "Ime Igraca %s: ID: %d - "CRVENA"%s", GetName(playerid), playerid, country);
    SendAdminMessage(0xFFFF80C8, str);

   if(IsPlayerNPC(playerid));[/pawn]
OnPlayerSpawn: [pawn]public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
   g_Requesting[playerid] = false;
   g_IsPaused[playerid] = false;
   TogglePlayerControllable(playerid, 0);
   g_freeze[playerid] =  SetTimerEx("Freeze",3000, false, "i", playerid);
//    UnfreezujNaSpawnu(playerid);
    if (PlayerInfo[playerid][pSupporter] >= 1 || PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pImunitet] >= 1 || PlayerInfo[playerid][pVlasnik] >= 2 || PlayerInfo[playerid][pTestAdmin] >= 1 || PlayerInfo[playerid][pSuvlasnik] >= 1 || PlayerInfo[playerid][pMapper] >= 1) UpaliAltChat(playerid); //onplayerspawn
     if (PlayerInfo[playerid][pSupporter] >= 1 || PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pImunitet] >= 1 || PlayerInfo[playerid][pVlasnik] >= 2 || PlayerInfo[playerid][pTestAdmin] >= 1 || PlayerInfo[playerid][pSuvlasnik] >= 1 || PlayerInfo[playerid][pMapper] >= 1) TogAltChat[ playerid ] = false; //onplayerspawn
    for(new i=0; i < sizeof(GZ); i++)[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): :o
Slika/video ingame problema(obavezno ako je ingame problem): :o



Citat: mus4. poslato Jun 20, 2019, 14:56:42 POSLE PODNE
daj komandu kad kupuješ vozilo
Ista stvar kada se kupuju i motori, plovila, letelice.....
[pawn]CMD:kupiauto(playerid, params[])
{
   
   
   if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1,"***"BELA"SGaming:"CRVENA"Moras se ulogovati da bi koristio ovu komandu!");
   if(PlayerInfo[playerid][pDvaV] == 1)
   {
      if(PlayerInfo[playerid][pPosedovanjeAuta] != -1 && PlayerInfo[playerid][pPosedovanjeAuta2] != -1) return SCM(playerid,-1,""SIVA"Vec posedujes 2 auta!");
   }
   else
   {
      if(PlayerInfo[playerid][pPosedovanjeAuta] != -1) return SCM(playerid,-1,""SIVA"Vec posedujes auto!");
   }
   //if(PlayerInfo[playerid][pLevel] < 16) return SCM(playerid,-1,""SIVA"Morate biti level 16+ za kupovinu auta!");
   if(IsPlayerInRangeOfPoint(playerid, 5.0, 956.2712,-1743.1976,13.9308) || IsPlayerInRangeOfPoint(playerid, 5.0, 2172.9819,1400.6012,11.0625))
   {
      new string[128];
      if(KupovinaAuta[playerid] == true) return SCM(playerid,-1,""SIVA"Vec gledate katalog vozila!");
      if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid,-1,""SIVA"Ne mozete gledati katalog iz vozila!");
      if(ServerInfo[isdozvolakupovine] == 0) return SCM(playerid,-1,"***"BELA"SGaming:"CRVENA"Admin je zabranio kupovinu auta");
      if(autokatalog != 0) return SCM(playerid,-1,""SIVA"Neko vec pregleda katalog!");
      TogglePlayerControllable(playerid, 0); KupovinaAuta[playerid] = true; PrikaziVozilaTD(playerid); autokatalog = 1;
      format(string,sizeof(string),"%s",ImenaVozila[GetVehicleModel(IzlozbenoAuto) - 400]);
      PlayerTextDrawSetString(playerid,TDProdajaVozila[2][playerid],string);
      format(string,sizeof(string),"Cena: ~g~%d$",AutoSalon[AutoModel][1]);
      PlayerTextDrawSetString(playerid,TDProdajaVozila[3][playerid],string);
      SCM(playerid, -1, "***"BELA"SGaming:"PLAVA"VAZNO!!! SISTEM KORISTI VASE TRENUTNE TIPKE, DAKLE AKO STE MENJALI PROCITAJTE!!!");
       SCM(playerid, -1, "***"BELA"SGaming:"PLAVA"Koristite tipke NUMPAD 1-6 ili LEVO/DESNO za listanje vozila!");
      SCM(playerid, -1, "***"BELA"SGaming:"PLAVA"Za kupovinu stisnite ENTER ili F! ");
      SCM(playerid, -1, "***"BELA"SGaming:"PLAVA"Za izlaz stisnite tipku za skakanje!(SHIFT/SPACE)");
      SetPlayerCameraPos(playerid, 950.1714, -1720.2207, 16.1815);
      SetPlayerCameraLookAt(playerid, 950.9150, -1719.5563, 15.8114);
    }
    else if(UsaoAutoProdaja[playerid] != -1)
    {
        new i = UsaoAutoProdaja[playerid];
        if(VoziloInfo[vImaVlasnika] == 0)
      {
          new vid = CijeneAuta(GetVehicleModel(GetPlayerVehicleID(playerid)));
          if(PlayerInfo[playerid][pNovacDzep] < AutoSalon[vid][1]/2) return SCM(playerid,-1,""SIVA"Nemate dovoljno novca!");
          g_NovacMinus(playerid, AutoSalon[vid][1]/2);
            if(PlayerInfo[playerid][pPosedovanjeAuta] != -1)
         {
            PlayerInfo[playerid][pPosedovanjeAuta2] = i;
         }
         else
         {
            PlayerInfo[playerid][pPosedovanjeAuta] = i;
         }
         VoziloInfo[vRadio] = 0;
         VoziloInfo[vImaVlasnika] = 1; VoziloInfo[vZakljucan] = 1;
         VoziloInfo[vDroga] = 0; VoziloInfo[vMats] = 0;
         VoziloInfo[vOruzije] = -1; VoziloInfo[vMunicija] = 0;
         strmid(VoziloInfo[vVlasnik], GetName(playerid), 0, strlen(GetName(playerid)), 999);
           SacuvajVozilo(i); SavePlayer(playerid); TogglePlayerControllable(playerid, 1);
           va_SendClientMessage(playerid,-1,""PLAVA"(("BELA"SGaming"PLAVA"))"BELA"Uspesno ste kupili polovan auto za %d$ novca!",AutoSalon[vid][1]/2);
           UsaoAutoProdaja[playerid] = -1;
      }
      else return SCM(playerid,-1,""PLAVA"(("BELA"SGaming"PLAVA"))"SIVA"To vozilo nije na prodaju!");
    }
   return 1;
}[/pawn]

pod OnPlayerDisconnect dodaj

[pawn]SacuvajVozilo(i);[/pawn] jer to ti je jedino čuvanje za vozila

i pod OnPlayerConnect stavi provjeru ako ima vozilo da ga spawnuje i to bi bilo to ja mislim

Citat: mus4. poslato Jun 20, 2019, 21:14:38 POSLE PODNE
pod OnPlayerDisconnect dodaj

[pawn]SacuvajVozilo(i);[/pawn] jer to ti je jedino čuvanje za vozila

i pod OnPlayerConnect stavi provjeru ako ima vozilo da ga spawnuje i to bi bilo to ja mislim

Vec ima: [pawn]      if(PlayerInfo[playerid][pPosedovanjeAuta] != -1)
      {
         DestroyVehicle(VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta]][vID]);
         SacuvajVozilo(PlayerInfo[playerid][pPosedovanjeAuta]);
         VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta]][vID] = -1;
      }
      if(PlayerInfo[playerid][pPosedovanjeAuta2] != -1)
      {
         DestroyVehicle(VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta2]][vID]);
         SacuvajVozilo(PlayerInfo[playerid][pPosedovanjeAuta2]);
         VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta2]][vID] = -1;
      }
      if(PlayerInfo[playerid][pPosedovanjeMotora] != -1)
      {
         DestroyVehicle(MotorInfo[PlayerInfo[playerid][pPosedovanjeMotora]][mID]);
         SacuvajMotor(PlayerInfo[playerid][pPosedovanjeMotora]);
         MotorInfo[PlayerInfo[playerid][pPosedovanjeMotora]][mID] = -1;
      }
      if(PlayerInfo[playerid][pPosedovanjeAviona] != -1)
      {
         DestroyVehicle(AvionInfo[PlayerInfo[playerid][pPosedovanjeAviona]][avID]);
         SacuvajAvione(PlayerInfo[playerid][pPosedovanjeAviona]);
         AvionInfo[PlayerInfo[playerid][pPosedovanjeAviona]][avID] = -1;
      }
      if(PlayerInfo[playerid][pPosedovanjePlovila] != -1)
      {
         DestroyVehicle(PlovilaInfo[PlayerInfo[playerid][pPosedovanjePlovila]][plID]);
         SacuvajPlovila(PlayerInfo[playerid][pPosedovanjePlovila]);
         PlovilaInfo[PlayerInfo[playerid][pPosedovanjePlovila]][plID] = -1;
      }[/pawn]

Nasao sam nesto[pawn]    if(IsPlayerConnected(playerid))
   {
      if(IsPlayerInRangeOfPoint(playerid, 3, 1439.4565,-1600.3640,12.8287)
      || IsPlayerInRangeOfPoint(playerid, 3,1520.9203,-1723.8739,12.9074)
      || IsPlayerInRangeOfPoint(playerid, 3,1720.2113,-1720.6504,13.0882)
      || IsPlayerInRangeOfPoint(playerid, 3,2076.8735,-1763.9585,13.1181)
      || IsPlayerInRangeOfPoint(playerid, 3,1859.1302,-1190.2970,23.3782)
      || IsPlayerInRangeOfPoint(playerid, 3,1839.0138,-1190.6035,23.3964)
      || IsPlayerInRangeOfPoint(playerid, 3,2151.2085,-1106.8328,24.8984)
      || IsPlayerInRangeOfPoint(playerid, 3,1369.7290,-956.8192,33.8953)
      || IsPlayerInRangeOfPoint(playerid, 3,1361.6124,-1023.0728,26.3019)
      || IsPlayerInRangeOfPoint(playerid, 3,784.9205,-1137.7577,23.4839)
      || IsPlayerInRangeOfPoint(playerid, 3,786.0815,-1415.9261,13.1072)
      || IsPlayerInRangeOfPoint(playerid, 3,1051.2428,-1416.2891,13.1109)
      || IsPlayerInRangeOfPoint(playerid, 3,1081.6346,-1749.8462,13.3482)
      || IsPlayerInRangeOfPoint(playerid, 3,1806.3594,-1597.5276,13.6161))
      {
           return 1;
      }
   }
   return 0;
}
forward VehProtection(vehicleid);
public VehProtection(vehicleid)
{
    for(new i = 0; i < sizeof(VoziloInfo); i++)
   {
      new Fajl[64];
       format(Fajl, sizeof(Fajl), AUTO_FILE, i);
      if(!fexist(Fajl))
      {
          if(VoziloInfo[vID] == vehicleid)
          {
             if(VoziloInfo[vSpawn] == 1) SetVehicleVirtualWorld(vehicleid, 100);
         }
      }
   }
   for(new i = 0; i < sizeof(MotorInfo); i++)
   {
      new Fajl[64];
       format(Fajl, sizeof(Fajl), MOTOR_FILE, i);
      if(!fexist(Fajl))
      {
          if(MotorInfo[mID] == vehicleid)
          {
             if(MotorInfo[mSpawn] == 1) SetVehicleVirtualWorld(vehicleid, 100);
         }
      }
   }
   for(new i = 0; i < sizeof(AvionInfo); i++)
   {
      new Fajl[64];
       format(Fajl, sizeof(Fajl), AVION_FILE, i);
      if(!fexist(Fajl))
      {
          if(AvionInfo[avID] == vehicleid)
          {
             if(AvionInfo[avSpawn] == 1) SetVehicleVirtualWorld(vehicleid, 100);
         }
      }
   }
   for(new i = 0; i < sizeof(PlovilaInfo); i++)
   {
      new Fajl[64];
       format(Fajl, sizeof(Fajl), PLOVILA_FILE, i);
      if(!fexist(Fajl))
      {
          if(PlovilaInfo[plID] == vehicleid)
          {
             if(PlovilaInfo[plSpawn] == 1) SetVehicleVirtualWorld(vehicleid, 100);
         }
      }
   }
}

forward VozilaProtect();
public VozilaProtect()
{
    for(new h = (0); h < sizeof(VoziloInfo); h++)
    {
        new hFile[64];
        format(hFile, sizeof(hFile), AUTO_FILE, h);
        if(fexist(hFile))
        {
            VoziloInfo[h][vSpawn] = 1;
            //SetVehicleVirtualWorld(VoziloInfo[h][vID], 100);
            //SacuvajVozilo(h);
        }
    }
    for(new h = (0); h < sizeof(PlovilaInfo); h++)
    {
        new hFile[64];
        format(hFile, sizeof(hFile), PLOVILA_FILE, h);
        if(fexist(hFile))
        {
            PlovilaInfo[h][plSpawn] = 1;
            //SetVehicleVirtualWorld(PlovilaInfo[h][plID], 100);
            //SacuvajPlovila(h);
        }
    }
    for(new h = (0); h < sizeof(AvionInfo); h++)
    {
        new hFile[64];
        format(hFile, sizeof(hFile), AVION_FILE, h);
        if(fexist(hFile))
        {
            AvionInfo[h][avSpawn] = 1;
            //SetVehicleVirtualWorld(AvionInfo[h][avID], 100);
            //SacuvajAvione(h);
        }
    }
    for(new h = (0); h < sizeof(MotorInfo); h++)
    {
        new hFile[64];
        format(hFile, sizeof(hFile), MOTOR_FILE, h);
        if(fexist(hFile))
        {
            MotorInfo[h][mSpawn] = 1;
            //SetVehicleVirtualWorld(MotorInfo[h][mID], 100);
            //SacuvajMotor(h);
        }
    }
}
/////////////////////////////////////[/pawn]

de naÄ'i u skripti to [pawn]vSpawn[/pawn]
[pawn]mSpawn[/pawn] i to pa postavi

Citat: mus4. poslato Jun 20, 2019, 23:24:36 POSLE PODNE
de naÄ'i u skripti to [pawn]vSpawn[/pawn]
[pawn]mSpawn[/pawn] i to pa postavi
Nasao sam ovo: [pawn]VoziloInfo[vSpawn] = 0;[/pawn]
Ali ne znam tacno gde da postavim
:'(

probaj jednostavno na komandi kupivozilo napravit da seta poziciju auta na nekoj pijaci i tjt, i kad igrac ode sa servera gdje je auto parkirano da ga savea tu, pokušaj nešto na taj fazon ako ne htjedne stvarno ne znam hahahah

Citat: mus4. poslato Jun 21, 2019, 17:33:29 POSLE PODNE
probaj jednostavno na komandi kupivozilo napravit da seta poziciju auta na nekoj pijaci i tjt, i kad igrac ode sa servera gdje je auto parkirano da ga savea tu, pokušaj nešto na taj fazon ako ne htjedne stvarno ne znam hahahah
Vec ima i kada se auto kupi, spawna se, moze se voziti itd...
Sumnjam da je komanda /v - parkiraj auto ili kod connecta da spawna.

[pawn]CMD:avparkiraj(playerid, params[])
{
   
   
    if(UlogovanProvera[playerid] == 0) return SendMessage( playerid, "Morate se ulogovati da bi pisali.");
    if(PlayerInfo[playerid][pAdmin] < 5) return SCM(playerid,-1,""CRVENA"[SG:RP] "SIVA"Samo ALVL 5+!");
    if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid,-1,""SIVA"Niste u vozilu!");
    new i, Float:PozAS[4];
   for(new j = 0; j < sizeof(VoziloInfo); j++)
   {
      if(GetPlayerVehicleID(playerid) == VoziloInfo[j][vID])
      {
         i = j;
      }
   }
   GetVehiclePos(VoziloInfo[vID], PozAS[0], PozAS[1], PozAS[2]);
   GetVehicleZAngle(VoziloInfo[vID], PozAS[3]);
   VoziloInfo[vSpawn] = 0;
   VoziloInfo[vPozX] = PozAS[0];
   VoziloInfo[vPozY] = PozAS[1];
   VoziloInfo[vPozZ] = PozAS[2];
   VoziloInfo[vPozA] = PozAS[3];
   DestroyVehicle(VoziloInfo[vID]);
   VoziloInfo[vID] = CreateVehicle(VoziloInfo[vModel],VoziloInfo[vPozX],VoziloInfo[vPozY],VoziloInfo[vPozZ],VoziloInfo[vPozA],VoziloInfo[vBoja1],VoziloInfo[vBoja2],30000);
    va_SendClientMessage(playerid,-1,"[SG:RP] "ZELENA"Vozilo je uspesno parkirano ID: %d!",i);
   SacuvajVozilo(i); RTC(VoziloInfo[vID]);
   return 1;
}[/pawn]
Nasao sam ovo...............
90% sam siguran da je do onplayerconnect.
Onplayerconnect(ja mislim da je ovo)
[pawn]new szPlayer[MAX_PLAYER_NAME];
      GetPlayerName(playerid, szPlayer, MAX_PLAYER_NAME);
        if(PlayerInfo[playerid][pPosedovanjeAuta] != -1) {

         new i = PlayerInfo[playerid][pPosedovanjeAuta];
         new vFile[50];
         format(vFile, sizeof(vFile), AUTO_FILE, i);
         if(fexist(vFile)) {
            INI_ParseFile(vFile, "UcitajVozila", .bExtra = true, .extra = i);

            if(strcmp(szPlayer, VoziloInfo[vVlasnik], true) == 0) {
               VoziloInfo[vID] = CreateVehicle(VoziloInfo[vModel],VoziloInfo[vPozX],VoziloInfo[vPozY],VoziloInfo[vPozZ],VoziloInfo[vPozA],VoziloInfo[vBoja1],VoziloInfo[vBoja2],30000);
               VoziloInfo[vSpawn] = 0;
               VoziloInfo[vMod][0] = -1;
               INI_ParseFile(vFile, "UcitajTune", .bExtra = true, .extra = i);
               for(new id = 1; id <= 17; id++)
               {
                  if(VoziloInfo[vMod][id]!=0) { AddVehicleComponent(VoziloInfo[vID],VoziloInfo[vMod][id]); }
               }
               if(VoziloInfo[vMod][0]>=0) { ChangeVehiclePaintjob(VoziloInfo[vID],VoziloInfo[vMod][0]); }
            }
         }
      }[/pawn]

ne znam Å¡ta bi moglo bit' sve je uredno napisano i po pravilima lol

Zasto koristite te UP modove koji jos uvijek koriste SetPVar? Zar nije jednostavnije bilo uraditi CoS koji ima enum vPosX, vPosY, vPosZ i kad se starta server da spawnuje sva vozila koja imaju koordinate ( koja su kreirana ), a ne PVarove na connectu
Third-party Pawn Developer

Citat: Salesman poslato Jun 22, 2019, 13:52:58 POSLE PODNE
Zasto koristite te UP modove koji jos uvijek koriste SetPVar? Zar nije jednostavnije bilo uraditi CoS koji ima enum vPosX, vPosY, vPosZ i kad se starta server da spawnuje sva vozila koja imaju koordinate ( koja su kreirana ), a ne PVarove na connectu
Zato sto ima dosta dobrih stvari, a ja sam pocetnik u skriptanju.

Ocu li na ovoh temi traziti pomoc da napravim cmd koja spavna auto na pocetku srwa kao sto je @Salesman rekao ili da napravim drugu temu?

Malo se kasno uključujem u raspravu....
OnPlayerDisconnect zamijeni spremanje i unistavanje
[pawn]
      if(PlayerInfo[playerid][pPosedovanjeAuta] != -1)
      {
         DestroyVehicle(VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta]][vID]);
         SacuvajVozilo(PlayerInfo[playerid][pPosedovanjeAuta]);
         VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta]][vID] = -1;
      }[/pawn]

[pawn]
      if(PlayerInfo[playerid][pPosedovanjeAuta] != -1)
      {
                        SacuvajVozilo(PlayerInfo[playerid][pPosedovanjeAuta]);
         DestroyVehicle(VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta]][vID]);
         VoziloInfo[PlayerInfo[playerid][pPosedovanjeAuta]][vID] = -1;
      }[/pawn]