Can't Figure Out This Simple Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Can't Figure Out This Simple Command (
/showthread.php?tid=656183)
Can't Figure Out This Simple Command -
NinjaChicken - 09.07.2018
Really starting to get a tad annoyed with this but basically i'm trying to make a command,
CMD:dvsavemods where it will save the damn dynamic vehicle modifications to the database, this is where i'm at
Код:
CMD:dvsavemods(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid), iDvSlotID = DynVeh[vehicleid];
if(iDvSlotID == -1 || iDvSlotID > MAX_DYNAMIC_VEHICLES || DynVehicleInfo[iDvSlotID][gv_iSpawnedID] != vehicleid)
{
return SendClientMessageEx(playerid, COLOR_GRAD1, " Invalid Dynamic Vehicle ID Provided!" );
}
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || (PlayerInfo[playerid][pLeader] == DynVehicleInfo[iDvSlotID][gv_igID]) && DynVehicleInfo[iDvSlotID][gv_igID] != INVALID_GROUP_ID) {
//GetVehiclePos(vehicleid, DynVehicleInfo[iDvSlotID][gv_fX], DynVehicleInfo[iDvSlotID][gv_fY], DynVehicleInfo[iDvSlotID][gv_fZ]);
//GetVehicleZAngle(vehicleid, DynVehicleInfo[iDvSlotID][gv_fRotZ]);
//DynVehicleInfo[iDvSlotID][gv_iVW] = GetPlayerVirtualWorld(playerid);
//DynVehicleInfo[iDvSlotID][gv_iInt] = GetPlayerInterior(playerid);
//DynVeh_Save(iDvSlotID);
//UpdateGroupVehicleMods(groupvehicleid);
//UpdateGroupVehicleMods(iDvSlotID);
UpdateGroupVehicleMods(DynVeh[groupvehicleid]);
//DynVeh_Spawn(iDvSlotID);
}
else return SendClientMessageEx(playerid, COLOR_GREY, "You can't save modifications to this vehicle.");
}
return 1;
}
Код:
stock UpdateGroupVehicleMods(groupvehicleid)
{
if(GetVehicleModel(DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][gv_iSpawnedID])) {
new carid = DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][gv_iSpawnedID];
new exhaust, frontbumper, rearbumper, roof, spoilers, sideskirt1,
sideskirt2, wheels, hydraulics, nitro, hood, lamps, stereo, ventright, ventleft;
exhaust = GetVehicleComponentInSlot(carid, CARMODTYPE_EXHAUST);
frontbumper = GetVehicleComponentInSlot(carid, CARMODTYPE_FRONT_BUMPER);
rearbumper = GetVehicleComponentInSlot(carid, CARMODTYPE_REAR_BUMPER);
roof = GetVehicleComponentInSlot(carid, CARMODTYPE_ROOF);
spoilers = GetVehicleComponentInSlot(carid, CARMODTYPE_SPOILER);
sideskirt1 = GetVehicleComponentInSlot(carid, CARMODTYPE_SIDESKIRT);
sideskirt2 = GetVehicleComponentInSlot(carid, CARMODTYPE_SIDESKIRT);
wheels = GetVehicleComponentInSlot(carid, CARMODTYPE_WHEELS);
hydraulics = GetVehicleComponentInSlot(carid, CARMODTYPE_HYDRAULICS);
nitro = GetVehicleComponentInSlot(carid, CARMODTYPE_NITRO);
hood = GetVehicleComponentInSlot(carid, CARMODTYPE_HOOD);
lamps = GetVehicleComponentInSlot(carid, CARMODTYPE_LAMPS);
stereo = GetVehicleComponentInSlot(carid, CARMODTYPE_STEREO);
ventright = GetVehicleComponentInSlot(carid, CARMODTYPE_VENT_RIGHT);
ventleft = GetVehicleComponentInSlot(carid, CARMODTYPE_VENT_LEFT);
if(spoilers >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][0] = spoilers;
if(hood >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][1] = hood;
if(roof >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][2] = roof;
if(sideskirt1 >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][3] = sideskirt1;
if(lamps >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][4] = lamps;
if(nitro >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][5] = nitro;
if(exhaust >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][6] = exhaust;
if(wheels >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][7] = wheels;
if(stereo >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][8] = stereo;
if(hydraulics >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][9] = hydraulics;
if(frontbumper >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][10] = frontbumper;
if(rearbumper >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][11] = rearbumper;
if(ventright >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][12] = ventright;
if(ventleft >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][13] = ventleft;
if(sideskirt2 >= 1000) DynVehicleInfo[DynVeh[groupvehicleid]][gv_iMod][14] = sideskirt2;
DynVeh_Save(DynVeh[groupvehicleid]);
}
}
And no matter what i try and do it always spams the server log with this shit
Код:
[21:04:52] [zcmd] [Eatlag]: /gr eat
[21:04:52] INSERT INTO `Admin` (`Timestamp`,`PlayerID`,`TargetID`,`LogText`,`PlayerIP`,`TargetIP`) VALUES ('1531134292','2','2','gave gr','124.149.206.15','124.149.206.15')
[21:04:54] [zcmd] [Eatlag]: /dvpark
[21:04:54] [debug] Run time error 4: "Array index out of bounds"
[21:04:54] [debug] Attempted to read/write array element at negative index -1
[21:04:54] [debug] AMX backtrace:
[21:04:54] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:04:54] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:04:54] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:04:54] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:04:56] [zcmd] [Eatlag]: /dvpark
[21:04:56] [debug] Run time error 4: "Array index out of bounds"
[21:04:56] [debug] Attempted to read/write array element at negative index -1
[21:04:56] [debug] AMX backtrace:
[21:04:56] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:04:56] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:04:56] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:04:56] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:04:58] [zcmd] [Eatlag]: /dvpark
[21:04:58] [debug] Run time error 4: "Array index out of bounds"
[21:04:58] [debug] Attempted to read/write array element at negative index -1
[21:04:58] [debug] AMX backtrace:
[21:04:58] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:04:58] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:04:58] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:04:58] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:04:59] [zcmd] [Eatlag]: /dvpark
[21:04:59] [debug] Run time error 4: "Array index out of bounds"
[21:04:59] [debug] Attempted to read/write array element at negative index -1
[21:04:59] [debug] AMX backtrace:
[21:04:59] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:04:59] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:04:59] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:04:59] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:05:00] [zcmd] [Eatlag]: /dvpark
[21:05:00] [debug] Run time error 4: "Array index out of bounds"
[21:05:00] [debug] Attempted to read/write array element at negative index -1
[21:05:00] [debug] AMX backtrace:
[21:05:00] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:05:00] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:05:00] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:05:00] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:05:01] [zcmd] [Eatlag]: /dvpark
[21:05:01] [debug] Run time error 4: "Array index out of bounds"
[21:05:01] [debug] Attempted to read/write array element at negative index -1
[21:05:01] [debug] AMX backtrace:
[21:05:01] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:05:01] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:05:01] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:05:01] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:05:01] [zcmd] [Eatlag]: /dvpark
[21:05:01] [debug] Run time error 4: "Array index out of bounds"
[21:05:01] [debug] Attempted to read/write array element at negative index -1
[21:05:01] [debug] AMX backtrace:
[21:05:01] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:05:01] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:05:01] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:05:01] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:05:03] [zcmd] [Eatlag]: /dvpark
[21:05:03] [debug] Run time error 4: "Array index out of bounds"
[21:05:03] [debug] Attempted to read/write array element at negative index -1
[21:05:03] [debug] AMX backtrace:
[21:05:03] [debug] #0 005bcae8 in UpdateGroupVehicleMods (groupvehicleid=303) at ./includes/vehsystem/groupvehs.pwn:279
[21:05:03] [debug] #1 0069b89c in public cmd_dvpark (playerid=0, params[]=@0b87dd74 "") at ./includes/group/groupcore.pwn:3798
[21:05:03] [debug] #2 native CallLocalFunction () from samp-server.exe
[21:05:03] [debug] #3 00000ca4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0b87dd54 "/dvpark") at C:\Users\Cam\Dropbox\Next Level Gaming 2018\Pawno Compiler\include\ZCMD.inc:102
[21:05:09] [zcmd] [Eatlag]: /rac
[21:11:41] [connection] incoming connection: 39.48.62.43:54798 id: 1
[21:11:42] [join] Danny_Ranner has joined the server (1:39.48.62.43)
[21:11:42] [PlayerName] Formatted Danny_Ranner to the correct RP-format standards.