EditDynamicObject Bug
#1

So I am trying to add a Position mover to the table system, but seems like when I call the editdynamicobject callback it Edits the location but it's not saving the new coordinates in the mysql database.

Код:
CMD:edittable(playerid, params[])
{
 	new id = GetPVarInt(playerid, "BizzKey");
	if(id == 0) return error(playerid, "You do not own a property.");
    if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "Tqven unda ikot shesuli serverze am brdzanebis gamosakeneblad.");
	if (GetPVarInt(playerid, "Dead") > 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not able to use this!");
    if (GetPVarInt(playerid, "Mute") == 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not able to use this!");
    if (GetPVarInt(playerid, "Cuffed") != 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not able to use this!");
    if(GetPVarInt(playerid, "Jailed") != 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not able to use this!");
    if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "You must be on foot to use this.");

	for(new i = 0; i < MAX_POKERTABLES; i++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.0, PokerTable[i][pkrX], PokerTable[i][pkrY], PokerTable[i][pkrZ]))
		{
            SendClientMessage(playerid, COLOR_GREY, "Tqven shegidzliat gadaadgilot Pokeris magida !");
		    SetPVarFloat(playerid, "tmpPkrX", PokerTable[i][pkrX]);
		    SetPVarFloat(playerid, "tmpPkrY", PokerTable[i][pkrY]);
		    SetPVarFloat(playerid, "tmpPkrZ", PokerTable[i][pkrZ]);
		    SetPVarFloat(playerid, "tmpPkrRX", PokerTable[i][pkrRX]);
		    SetPVarFloat(playerid, "tmpPkrRY", PokerTable[i][pkrRY]);
		    SetPVarFloat(playerid, "tmpPkrRZ", PokerTable[i][pkrRZ]);
		    SetPVarInt(playerid,"PlantPOKER", 1);

			EditDynamicObject(playerid, PokerTable[i][pkrObjectID]);
			break;
		}
	}
	return 1;
}

Here is the OnplayerEditDynamicObject part of the system, here is :

Код:
if(GetPVarInt(playerid, "PlantPOKER") == 1) {
		if(response == EDIT_RESPONSE_FINAL)
	    {
	            if(GetPVarType(playerid, "tmpEditPokerTableID")) {
	                    new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;
	                    DeletePVar(playerid, "tmpEditPokerTableID");

	                    DeletePVar(playerid, "tmpPkrX");
	                    DeletePVar(playerid, "tmpPkrY");
	                    DeletePVar(playerid, "tmpPkrZ");
	                    DeletePVar(playerid, "tmpPkrRX");
	                    DeletePVar(playerid, "tmpPkrRY");
	                    DeletePVar(playerid, "tmpPkrRZ");
	                    DeletePVar(playerid, "PlantPOKER");


	                    DestroyPokerTable(tableid);
	                    PlacePokerTable(tableid, 1, x, y, z, rx, ry, rz, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));

                        SavePokerTables(tableid);
	                    	ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
	            }
	    }

	    if(response == EDIT_RESPONSE_CANCEL)
	    {
	            if(GetPVarType(playerid, "tmpEditPokerTableID")) {
	                    new tableid = GetPVarInt(playerid, "tmpEditPokerTableID")-1;
	                    DeletePVar(playerid, "tmpEditPokerTableID");

	                    DestroyPokerTable(tableid);
	                    PlacePokerTable(tableid, 0, GetPVarFloat(playerid, "tmpPkrX"), GetPVarFloat(playerid, "tmpPkrY"), GetPVarFloat(playerid, "tmpPkrZ"), GetPVarFloat(playerid, "tmpPkrRX"), GetPVarFloat(playerid, "tmpPkrRY"), GetPVarFloat(playerid, "tmpPkrRZ"), GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));

	                    DeletePVar(playerid, "tmpPkrX");
	                    DeletePVar(playerid, "tmpPkrY");
	                    DeletePVar(playerid, "tmpPkrZ");
	                    DeletePVar(playerid, "tmpPkrRX");
	                    DeletePVar(playerid, "tmpPkrRY");
	                    DeletePVar(playerid, "tmpPkrRZ");
	                    DeletePVar(playerid, "PlantPOKER");

                        SavePokerTables(tableid);
	                    	ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);
	            }
	    }
	}
IMPORTANT: It's not showing the "ShowCasinoGamesMenu(playerid, DIALOG_CGAMESSELECTPOKER);" Dialog

P.S: SQL saving system is okay it's tested on another system.
Reply
#2

If the table ID is 0, you will address it as -1 since you're assigning the "tableid" variable value to the table ID minus 1. That means there is a runtime error and SavePokerTable isn't working.

Could be? Show us SavePokerTable code.
Reply
#3

Thanks <3333 rep +
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)