Zeex / samp-plugin-crashdetect

Crash/error reporting plugin for SA-MP server
http://forum.sa-mp.com/showthread.php?t=262796
BSD 2-Clause "Simplified" License
116 stars 23 forks source link

Pawn Help! [debug] Run time error 5: "Invalid memory access" #97

Open PutuSuhartawan opened 3 years ago

PutuSuhartawan commented 3 years ago
Code:
[debug] Run time error 5: "Invalid memory access"
[debug] AMX backtrace:
[debug] #0 003cb664 in public OnPlayerEditDynamicObject (playerid=3, objectid=16000, response=1, Float:x=-1794.16113, Float:y=-326.82227, Float:z=23.70365, Float:rx=0.00000, Float:ry=0.00000, Float:rz=0.00000) at e:\GAME\Server PutuSuhartawansamp03DL_svr_R1_win32\gamemodes\SuhartawanWorld.pwn:11020

How to fix on this warning sir?

` public OnPlayerEditDynamicObject(playerid, STREAMER_TAG_OBJECT:objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) //public OnPlayerEditDynamicObject(playerid, STREAMER_TAG_OBJECT:objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz); { new Float:ofx, Float:ofy, Float:ofz; new Float:ofaz, Float:finalx, Float:finaly; new Float:px, Float:py, Float:pz, Float:roz; new closestcar = GetClosestCar(playerid, INVALID_VEHICLE_ID); //SendClientMessage(playerid, COLOR_RED, "Anda Sedang Mengedit DynamicObject."); if(response == EDIT_RESPONSE_UPDATE && inEditingMode[playerid] == 1) {

              /*
              GetVehiclePos(closestcar, px, py, pz);
              GetVehicleZAngle(closestcar, roz);
              ofx = x-px;
              ofy = y-py;
              ofz = z-pz;
              ofaz = rz-roz;
              finalx = ofx*floatcos(roz, degrees)+ofy*floatsin(roz, degrees);
              finaly = -ofx*floatsin(roz, degrees)+ofy*floatcos(roz, degrees);
              */
              //SetDynamicObjectPos(objectid, finalx, finaly, ofz);
              //SetDynamicObjectRot(objectid, rx, ry, ofaz);
              //SendClientMessage(playerid, COLOR_RED, "ATTACHED OBJECT: Sir you have try to edit attached dynamic object Position or Rotation now response updated.");
              //Streamer_Update(playerid);
              return 1;

      }
      if(response == EDIT_RESPONSE_UPDATE && inEditingMode[playerid] == 0)
      {

              SendClientMessage(playerid, COLOR_RED, "NON ATTACHED: Sir you have try to edit but not on editing attached  dynamic object Position or Rotation now response updated.");
              return 1;

      }
      else if(response == EDIT_RESPONSE_CANCEL)
      {
          SendClientMessage(playerid, COLOR_RED, "Sir you have Cancel editing the DynamicObject.");
      }

      else if(response == EDIT_RESPONSE_FINAL && inEditingMode[playerid] == 1)
      {
            inEditingMode[playerid] = 0;
            if (!IsPlayerInAnyVehicle(playerid))
                    return SendClientMessage(playerid, COLOR_RED, "Sir you need get in vehicle to edit the attached object");

                GetVehiclePos(GetPlayerVehicleID(playerid), px, py, pz);
                GetVehicleZAngle(GetPlayerVehicleID(playerid), roz);
                ofx = x-px;
                ofy = y-py;
                ofz = z-pz;
                ofaz = rz-roz;
                finalx = ofx*floatcos(roz, degrees)+ofy*floatsin(roz, degrees);
                finaly = -ofx*floatsin(roz, degrees)+ofy*floatcos(roz, degrees);

                SendClientMessage(playerid, COLOR_RED, "Sir you succes edited DynamicObject on attached.");
                GameTextForPlayer(playerid, "Sir you succes edited DynamicObject on attached.", 2000, 5);
                AttachDynamicObjectToVehicle(objectid, closestcar, finalx, finaly, ofz, rx, ry, ofaz);

            //SetDynamicObjectPos(objectid, x, y, z);

            //SetDynamicObjectRot(objectid, rx, ry, rz);
            //new materialindex, modelid, txdname[20], texturename[20];
            //GetDynamicObjectMaterial(objectid, materialindex, modelid, txdname, texturename);

            //GetDynamicObjectMaterial(objectid, materialindex, modelid);
            new DynamicObjectInformation[500];
            format(DynamicObjectInformation, sizeof(DynamicObjectInformation),
            "ID Dynamic Object in gamemode %i, Object ModelID:[%i] Coordinat: %f, %f, %f, Rotating in: %f, %f, %f)",
            objectid, modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
            SendClientMessage(playerid, COLOR_RED, DynamicObjectInformation);

            SelectObjectEx(playerid);
            return 1;
            //SelectObject(playerid);
      }
      else if(response == EDIT_RESPONSE_FINAL && inEditingMode[playerid] == 0)
      {

            SetDynamicObjectPos(objectid, x, y, z);
            SetDynamicObjectRot(objectid, rx, ry, rz);
            SendClientMessage(playerid, COLOR_RED, "Sir you succes edited Non Attached DynamicObject.");
            new DynamicObjectInformation[500];

            format(DynamicObjectInformation, sizeof(DynamicObjectInformation),
            "ID Dynamic Object in gamemode %i, Coordinat: %f, %f, %f, Rotating in: %f, %f, %f)",
            objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
            SendClientMessage(playerid, COLOR_RED, DynamicObjectInformation);
            inEditingMode[playerid] = 1;
            SelectObjectEx(playerid);
            return 1;
      }

return 1; } `

PutuSuhartawan commented 3 years ago

Issue forum: https://www.burgershot.gg/showthread.php?tid=2039