pvars resetting ( +rep )
#1

Код:
if(dialogid == neondialog)
   {
      if(response)
      {
         if(listitem == 0)
         {
             SetPVarInt(playerid, "Status", 1);
                SetPVarInt(playerid, "neon", CreateObject(18648,0,0,0,0,0,0));
                SetPVarInt(playerid, "neon1", CreateObject(18648,0,0,0,0,0,0));
                AttachObjectToVehicle(GetPVarInt(playerid, "neon"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                AttachObjectToVehicle(GetPVarInt(playerid, "neon1"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
                SendClientMessage(playerid, 0xFFFFFFAA, "Neon Albastru Instalat!");
            }
         if(listitem == 1)
         {
            SetPVarInt(playerid, "Status", 1);
               SetPVarInt(playerid, "neon2", CreateObject(18647,0,0,0,0,0,0));
               SetPVarInt(playerid, "neon3", CreateObject(18647,0,0,0,0,0,0));
               AttachObjectToVehicle(GetPVarInt(playerid, "neon2"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               AttachObjectToVehicle(GetPVarInt(playerid, "neon3"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               SendClientMessage(playerid, 0xFFFFFFAA, "Neon Rosu Instalat!");

            }
         if(listitem == 2)
         {
                SetPVarInt(playerid, "Status", 1);
               SetPVarInt(playerid, "neon4", CreateObject(18649,0,0,0,0,0,0));
               SetPVarInt(playerid, "neon5", CreateObject(18649,0,0,0,0,0,0));
               AttachObjectToVehicle(GetPVarInt(playerid, "neon4"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               AttachObjectToVehicle(GetPVarInt(playerid, "neon5"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               SendClientMessage(playerid, 0xFFFFFFAA, "Neon Verde Instalat!");

               }
         if(listitem == 3)
         {
                SetPVarInt(playerid, "Status", 1);
               SetPVarInt(playerid, "neon6", CreateObject(18652,0,0,0,0,0,0));
               SetPVarInt(playerid, "neon7", CreateObject(18652,0,0,0,0,0,0));
               AttachObjectToVehicle(GetPVarInt(playerid, "neon6"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               AttachObjectToVehicle(GetPVarInt(playerid, "neon7"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               SendClientMessage(playerid, 0xFFFFFFAA, "Neon Alb Instalat!");

            }
         if(listitem == 4)
         {
                SetPVarInt(playerid, "Status", 1);
               SetPVarInt(playerid, "neon8", CreateObject(18651,0,0,0,0,0,0));
               SetPVarInt(playerid, "neon9", CreateObject(18651,0,0,0,0,0,0));
               AttachObjectToVehicle(GetPVarInt(playerid, "neon8"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               AttachObjectToVehicle(GetPVarInt(playerid, "neon9"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               SendClientMessage(playerid, 0xFFFFFFAA, "Neon Roz Instalat!");

            }
         if(listitem == 5)
         {
              SetPVarInt(playerid, "Status", 1);
               SetPVarInt(playerid, "neon10", CreateObject(18650,0,0,0,0,0,0));
               SetPVarInt(playerid, "neon11", CreateObject(18650,0,0,0,0,0,0));
               AttachObjectToVehicle(GetPVarInt(playerid, "neon10"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               AttachObjectToVehicle(GetPVarInt(playerid, "neon11"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
               SendClientMessage(playerid, 0xFFFFFFAA, "Neon Galben Instalat!");

            }
         if(listitem == 6)
         {
         //Delete Neon
            DestroyObject(GetPVarInt(playerid, "neon"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon1"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon2"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon3"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon4"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon5"));
         DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon6"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon7"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon8"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon9"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon10"));
            DeletePVar(playerid, "Status");
            DestroyObject(GetPVarInt(playerid, "neon11"));
           }
      }
   }
   return 0;
When you put a neon on a car and you disconnect , after reconnect the pvars it's reseted , and y can't destroy the neon , what it's the solution?
If you give me a solution i give you +rep .
Reply
#2

You get any errors when you compile it ?
Reply
#3

No , i want to stop the pvar resetting.
After onplayerdisconnect the PVARS it's reseting.
Reply
#4

It is impossible to stop PVar from resetting. The idea of PVar is that you have a variable on player which is automatically deleted on disconnect.

You have pretty much 2 options:
1. Delete neons when player disconnects
2. Store the neon information in database (MySQL perhaps) instead of variables
Reply
#5

There is no other solution to destroy the neon ever?
Reply
#6

You must save the pvar info to ini file or mysql database to keep them after player disconnects.
Reply
#7

Put this in OnPlayerDisconnect:

pawn Код:
SetPVarInt(playerid, "Status", 0);
Reply
#8

How i can save the pvar info to de .ini file ?
Reply
#9

Do you have a player account system?
Reply
#10

I have accounts in /scriptfiles/user.ini !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)