Kako napraviti Create/Edit Object IG

Započeo Teodor
24. Apr. 2020.
1,691
pregleda
17
postova
Teodor
4
Made Man
24. Apr. 2020.
Problem(error/warning):Kao sto pise u naslovu, kako da napravim Create/Edit Object In Game, ako ima neki tutorijal kako to da napravim. Naravno da se sacuva svi ti Objecti koju su Creatovani i Editovani posle restarta
Dio skripte:
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
Slika/video ingame problema(obavezno ako je ingame problem): link slike
Agency
5
Underboss
Teodor
4
Made Man
24. Apr. 2020.
.agency wrote on April 24, 2020, 6:27 pm:
https://forum.sa-mp.com/showthread.php?t=384195

Ne radi mi /createobject NZM sto ukucam /createobject izadje mi Dialog_style_input tu upisem ID objeta i nista se ne desi
Agency
5
Underboss
24. Apr. 2020.
Teodor wrote on April 24, 2020, 8:28 pm:
Ne radi mi /createobject NZM sto ukucam /createobject izadje mi Dialog_style_input tu upisem ID objeta i nista se ne desi
Koji mod koristis?
Teodor
4
Made Man
24. Apr. 2020.
.agency wrote on April 24, 2020, 9:04 pm:
Koji mod koristis?

Svoj od 0
Teodor
4
Made Man
27. Apr. 2020.
BUMP
Skrilew
6
Godfather
27. Apr. 2020.
Proveri OnDialogResponse
Teodor
4
Made Man
27. Apr. 2020.
V01D wrote on April 27, 2020, 1:23 pm:
Proveri OnDialogResponse

Jedno objasnjenje kako ja sad ovo da ubacim u svoj mod, provalio sam da sam izbacio DialogResponse zbog ovih errora

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 10002 && response)// 1199
{
    if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `VW`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to virtualworld of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
    if(dialogid == 10003 && response)// 1211
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to interior of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
    if(dialogid == 10004 && response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `DISTANCE`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to distance of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
    if(dialogid == 10001 && response)
{
    if(listitem == 0)
    {
    EditDynamicObject(playerid, EDIT_OBJECT_ID);
    return SendClientMessage(playerid,DEF_COL_WHITE,"Usage ESC or the save icon to save the position.");
    }
    if(listitem == 1)
    {
    ShowPlayerDialog(playerid,10002,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the virtualworld you wan't to only stream this object in.\nUsage -1 to show it in all virtualworlds.","Save","Close");
    }
    if(listitem == 2)
    {
    ShowPlayerDialog(playerid,10003,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the interior you wan't to only stream this object in.\nUsage -1 to show it in all interior\nUsage /interior to see your currently interior.","Save","Close");
    }
    if(listitem == 3)
    {
    ShowPlayerDialog(playerid,10004,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the stream distance of this object. Default is 100.","Save","Close");
    }
    if(listitem == 4)
    {
        new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "DELETE FROM `OBJECTS` WHERE `ID`=%d",EDITOR_OBJECT[EDIT_OBJECT_ID]);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
DestroyDynamicObject(EDIT_OBJECT_ID);
return SendClientMessage(playerid,DEF_COL_WHITE,"You succesful deleted this object.");
    }
}
if(dialogid == 10000 && response)
{
    if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan't to create.","Create","Close");
    new Float:editor,id;
    GetPlayerPos(playerid,editor,editor,editor);
    id = CreateDynamicObject(strval(inputtext), editor+1, editor+1, editor, 0.0,0.0,0.0, -1, -1, -1, 100.0);

if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Error while creating object, it seems you are trying to create more objects then the max amount of objects.");
   
    EDITOR_OBJECT = strval(inputtext);
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = 100.0;
        EDIT_OBJECT_ID = id;
        EditDynamicObject(playerid, id);
       
        new EDITOR_QUERY;
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,'%f','%f','%f',%d)",
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
id+1000);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
new DBResult:EDITOR_RESULT;
        format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);
        if(db_num_rows(EDITOR_RESULT) == 1)
        {
            new temp;
            db_get_field(EDITOR_RESULT,0,temp,16);
EDITOR_OBJECT = strval(temp);
SendClientMessage(playerid,DEF_COL_WHITE,"Object ID received.");
        }
        db_free_result(EDITOR_RESULT);
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Object saved to database, Usage /editobject or /selectobject to edit this object.");
}
return 1;
}


ERRORI:

C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1199) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1199 -- 1200) : error 029: invalid expression, assumed zero
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1211) : warning 225: unreachable code
Pawn compiler 3.10.4 Copyright (c) 1997-2006, ITB CompuPhase

4 Errors.
Skrilew
6
Godfather
27. Apr. 2020.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 10002)
    {
  if(response)
{
    if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `VW`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to virtualworld of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
    else if(dialogid == 10003)
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to interior of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
    else if(dialogid == 10004)
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `DISTANCE`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to distance of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
    else if(dialogid == 10001)
{
if(response)
{
    if(listitem == 0)
    {
    EditDynamicObject(playerid, EDIT_OBJECT_ID);
    return SendClientMessage(playerid,DEF_COL_WHITE,"Usage ESC or the save icon to save the position.");
    }
    if(listitem == 1)
    {
    ShowPlayerDialog(playerid,10002,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the virtualworld you wan`t to only stream this object in.\nUsage -1 to show it in all virtualworlds.","Save","Close");
    }
    if(listitem == 2)
    {
    ShowPlayerDialog(playerid,10003,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the interior you wan`t to only stream this object in.\nUsage -1 to show it in all interior\nUsage /interior to see your currently interior.","Save","Close");
    }
    if(listitem == 3)
    {
    ShowPlayerDialog(playerid,10004,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the stream distance of this object. Default is 100.","Save","Close");
    }
    if(listitem == 4)
    {
        new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "DELETE FROM `OBJECTS` WHERE `ID`=%d",EDITOR_OBJECT[EDIT_OBJECT_ID]);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
DestroyDynamicObject(EDIT_OBJECT_ID);
return SendClientMessage(playerid,DEF_COL_WHITE,"You succesful deleted this object.");
    }
}
}
else if(dialogid == 10000)
{
if(response)
{
    if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan`t to create.","Create","Close");
    new Float:editor,id;
    GetPlayerPos(playerid,editor,editor,editor);
    id = CreateDynamicObject(strval(inputtext), editor+1, editor+1, editor, 0.0,0.0,0.0, -1, -1, -1, 100.0);

if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Error while creating object, it seems you are trying to create more objects then the max amount of objects.");
 
    EDITOR_OBJECT = strval(inputtext);
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = 100.0;
        EDIT_OBJECT_ID = id;
        EditDynamicObject(playerid, id);
     
        new EDITOR_QUERY;
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,`%f`,`%f`,`%f`,%d)",
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
id+1000);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
new DBResult:EDITOR_RESULT;
        format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);
        if(db_num_rows(EDITOR_RESULT) == 1)
        {
            new temp;
            db_get_field(EDITOR_RESULT,0,temp,16);
EDITOR_OBJECT = strval(temp);
SendClientMessage(playerid,DEF_COL_WHITE,"Object ID received.");
        }
        db_free_result(EDITOR_RESULT);
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Object saved to database, Usage /editobject or /selectobject to edit this object.");
    }
}
return 1;
}


Probaj ovako mozda
Teodor
4
Made Man
27. Apr. 2020.
V01D wrote on April 27, 2020, 2:36 pm:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 10002)
    {
  if(response)
{
    if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `VW`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to virtualworld of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
    else if(dialogid == 10003)
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to interior of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
    else if(dialogid == 10004)
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `DISTANCE`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to distance of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
    else if(dialogid == 10001)
{
if(response)
{
    if(listitem == 0)
    {
    EditDynamicObject(playerid, EDIT_OBJECT_ID);
    return SendClientMessage(playerid,DEF_COL_WHITE,"Usage ESC or the save icon to save the position.");
    }
    if(listitem == 1)
    {
    ShowPlayerDialog(playerid,10002,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the virtualworld you wan`t to only stream this object in.\nUsage -1 to show it in all virtualworlds.","Save","Close");
    }
    if(listitem == 2)
    {
    ShowPlayerDialog(playerid,10003,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the interior you wan`t to only stream this object in.\nUsage -1 to show it in all interior\nUsage /interior to see your currently interior.","Save","Close");
    }
    if(listitem == 3)
    {
    ShowPlayerDialog(playerid,10004,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the stream distance of this object. Default is 100.","Save","Close");
    }
    if(listitem == 4)
    {
        new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "DELETE FROM `OBJECTS` WHERE `ID`=%d",EDITOR_OBJECT[EDIT_OBJECT_ID]);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
DestroyDynamicObject(EDIT_OBJECT_ID);
return SendClientMessage(playerid,DEF_COL_WHITE,"You succesful deleted this object.");
    }
}
}
else if(dialogid == 10000)
{
if(response)
{
    if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan`t to create.","Create","Close");
    new Float:editor,id;
    GetPlayerPos(playerid,editor,editor,editor);
    id = CreateDynamicObject(strval(inputtext), editor+1, editor+1, editor, 0.0,0.0,0.0, -1, -1, -1, 100.0);

if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Error while creating object, it seems you are trying to create more objects then the max amount of objects.");
 
    EDITOR_OBJECT = strval(inputtext);
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = 100.0;
        EDIT_OBJECT_ID = id;
        EditDynamicObject(playerid, id);
     
        new EDITOR_QUERY;
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,`%f`,`%f`,`%f`,%d)",
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
id+1000);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
new DBResult:EDITOR_RESULT;
        format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);
        if(db_num_rows(EDITOR_RESULT) == 1)
        {
            new temp;
            db_get_field(EDITOR_RESULT,0,temp,16);
EDITOR_OBJECT = strval(temp);
SendClientMessage(playerid,DEF_COL_WHITE,"Object ID received.");
        }
        db_free_result(EDITOR_RESULT);
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Object saved to database, Usage /editobject or /selectobject to edit this object.");
    }
}
return 1;
}


Probaj ovako mozda

Nope ☹️

C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1199) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1199 -- 1200) : error 029: invalid expression, assumed zero
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1214) : error 029: invalid expression, assumed zero
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1214) : warning 215: expression has no effect
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1214) : error 001: expected token: ";", but found "if"
Pawn compiler 3.10.4 Copyright (c) 1997-2006, ITB CompuPhase

4 Errors.

if(dialogid == 10002) // 1199
else if(dialogid == 10003) // 1214
Skrilew
6
Godfather
27. Apr. 2020.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 10002:
{
if(response)
{
    if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `VW`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to virtualworld of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
case 10003:
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to interior of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
case 10004:
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `DISTANCE`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to distance of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
case 10001:
{
if(response)
{
if(response)
{
    if(listitem == 0)
    {
    EditDynamicObject(playerid, EDIT_OBJECT_ID);
    return SendClientMessage(playerid,DEF_COL_WHITE,"Usage ESC or the save icon to save the position.");
    }
    if(listitem == 1)
    {
    ShowPlayerDialog(playerid,10002,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the virtualworld you wan`t to only stream this object in.\nUsage -1 to show it in all virtualworlds.","Save","Close");
    }
    if(listitem == 2)
    {
    ShowPlayerDialog(playerid,10003,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the interior you wan`t to only stream this object in.\nUsage -1 to show it in all interior\nUsage /interior to see your currently interior.","Save","Close");
    }
    if(listitem == 3)
    {
    ShowPlayerDialog(playerid,10004,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the stream distance of this object. Default is 100.","Save","Close");
    }
    if(listitem == 4)
    {
        new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "DELETE FROM `OBJECTS` WHERE `ID`=%d",EDITOR_OBJECT[EDIT_OBJECT_ID]);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
DestroyDynamicObject(EDIT_OBJECT_ID);
return SendClientMessage(playerid,DEF_COL_WHITE,"You succesful deleted this object.");
    }
}
}
case 10000:
{
if(response)
{
if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan`t to create.","Create","Close");
    new Float:editor,id;
    GetPlayerPos(playerid,editor,editor,editor);
    id = CreateDynamicObject(strval(inputtext), editor+1, editor+1, editor, 0.0,0.0,0.0, -1, -1, -1, 100.0);

if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Error while creating object, it seems you are trying to create more objects then the max amount of objects.");
 
    EDITOR_OBJECT = strval(inputtext);
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = 100.0;
        EDIT_OBJECT_ID = id;
        EditDynamicObject(playerid, id);
     
        new EDITOR_QUERY;
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,`%f`,`%f`,`%f`,%d)",
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
id+1000);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
new DBResult:EDITOR_RESULT;
        format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);
        if(db_num_rows(EDITOR_RESULT) == 1)
        {
            new temp;
            db_get_field(EDITOR_RESULT,0,temp,16);
EDITOR_OBJECT = strval(temp);
SendClientMessage(playerid,DEF_COL_WHITE,"Object ID received.");
        }
        db_free_result(EDITOR_RESULT);
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Object saved to database, Usage /editobject or /selectobject to edit this object.");
}
}
}
return 1;
}


Aj sad..
Teodor
4
Made Man
27. Apr. 2020.
V01D wrote on April 27, 2020, 2:53 pm:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 10002:
{
if(response)
{
    if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `VW`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to virtualworld of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
case 10003:
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to interior of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
case 10004:
{
if(response)
{
if(!Numbers(inputtext) && strval(inputtext) != -1) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
new id = EDIT_OBJECT_ID;
new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `DISTANCE`=%d WHERE `ID`=%d",
strval(inputtext),
EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
SendClientMessage(playerid,DEF_COL_WHITE,"You successful changed to distance of this object.");
return ShowPlayerDialog(playerid,10001,DIALOG_STYLE_LIST,"{A80000}Edit Object","Position\nVirtual World\nInterior ID\nStream Distance\nDelete Object","Next","Close");
}
}
case 10001:
{
if(response)
{
if(response)
{
    if(listitem == 0)
    {
    EditDynamicObject(playerid, EDIT_OBJECT_ID);
    return SendClientMessage(playerid,DEF_COL_WHITE,"Usage ESC or the save icon to save the position.");
    }
    if(listitem == 1)
    {
    ShowPlayerDialog(playerid,10002,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the virtualworld you wan`t to only stream this object in.\nUsage -1 to show it in all virtualworlds.","Save","Close");
    }
    if(listitem == 2)
    {
    ShowPlayerDialog(playerid,10003,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the interior you wan`t to only stream this object in.\nUsage -1 to show it in all interior\nUsage /interior to see your currently interior.","Save","Close");
    }
    if(listitem == 3)
    {
    ShowPlayerDialog(playerid,10004,DIALOG_STYLE_INPUT,"{A80000}Virtual World","Insert the stream distance of this object. Default is 100.","Save","Close");
    }
    if(listitem == 4)
    {
        new EDITOR_QUERY;
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "DELETE FROM `OBJECTS` WHERE `ID`=%d",EDITOR_OBJECT[EDIT_OBJECT_ID]);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
DestroyDynamicObject(EDIT_OBJECT_ID);
return SendClientMessage(playerid,DEF_COL_WHITE,"You succesful deleted this object.");
    }
}
}
case 10000:
{
if(response)
{
if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan`t to create.","Create","Close");
    new Float:editor,id;
    GetPlayerPos(playerid,editor,editor,editor);
    id = CreateDynamicObject(strval(inputtext), editor+1, editor+1, editor, 0.0,0.0,0.0, -1, -1, -1, 100.0);

if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Error while creating object, it seems you are trying to create more objects then the max amount of objects.");
 
    EDITOR_OBJECT = strval(inputtext);
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = 100.0;
        EDIT_OBJECT_ID = id;
        EditDynamicObject(playerid, id);
     
        new EDITOR_QUERY;
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,`%f`,`%f`,`%f`,%d)",
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
id+1000);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
new DBResult:EDITOR_RESULT;
        format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);
        if(db_num_rows(EDITOR_RESULT) == 1)
        {
            new temp;
            db_get_field(EDITOR_RESULT,0,temp,16);
EDITOR_OBJECT = strval(temp);
SendClientMessage(playerid,DEF_COL_WHITE,"Object ID received.");
        }
        db_free_result(EDITOR_RESULT);
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Object saved to database, Usage /editobject or /selectobject to edit this object.");
}
}
}
return 1;
}


Aj sad..


Nece opet ☹️

case 10000://1277
{
if(response)
{
if(!Numbers(inputtext)) return SendClientMessage(playerid,DEF_COL_RED,"You only can use numbers!"),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan`t to create.","Create","Close");
new Float:editor,id;
GetPlayerPos(playerid,editor,editor,editor);
id = CreateDynamicObject(strval(inputtext), editor+1, editor+1, editor, 0.0,0.0,0.0, -1, -1, -1, 100.0);

if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(DEF_COL_WHITE,"Error while creating object, it seems you are trying to create more objects then the max amount of objects.");
 
  EDITOR_OBJECT = strval(inputtext);
    EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor+1;
        EDITOR_OBJECT = editor;
        EDITOR_OBJECT = 0.0;
    EDITOR_OBJECT = 0.0;
    EDITOR_OBJECT = 0.0;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = -1;
        EDITOR_OBJECT = 100.0;
        EDIT_OBJECT_ID = id;
        EditDynamicObject(playerid, id);
     
    new EDITOR_QUERY;
        format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "INSERT INTO `OBJECTS` (`MODEL`, `X`, `Y`, `Z`, `INT`) VALUES (%d,`%f`,`%f`,`%f`,%d)",
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
EDITOR_OBJECT,
id+1000);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
new DBResult:EDITOR_RESULT;
    format(EDITOR_QUERY,sizeof(EDITOR_QUERY),"SELECT `ID` FROM `OBJECTS` WHERE `INT`=%d",id+1000);
        EDITOR_RESULT = db_query(EDITOR_DATABASE,EDITOR_QUERY);

        if(db_num_rows(EDITOR_RESULT) == 1)
    {
        new temp;
            db_get_field(EDITOR_RESULT,0,temp,16);
EDITOR_OBJECT = strval(temp);
SendClientMessage(playerid,DEF_COL_WHITE,"Object ID received.");
        }
        db_free_result(EDITOR_RESULT);
format(EDITOR_QUERY, sizeof(EDITOR_QUERY), "UPDATE `OBJECTS` SET `INT`=-1 WHERE `ID`=%d",EDITOR_OBJECT);
db_free_result(db_query(EDITOR_DATABASE, EDITOR_QUERY));
        SendClientMessage(playerid,DEF_COL_WHITE,"Object saved to database, Usage /editobject or /selectobject to edit this object.");
}
}


C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1277) : warning 217: loose indentation
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1277) : error 014: invalid statement; not in switch
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1277) : warning 215: expression has no effect
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1277) : error 001: expected token: ";", but found ":"
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1277) : error 029: invalid expression, assumed zero
C:\Users\teodo\Desktop\Moj Server\gamemodes\DMTest.pwn(1277) : fatal error 107: too many error messages on one line
Teodor
4
Made Man
28. Apr. 2020.
Zna neko?
@V01D
@Galardo sry za DPI
Skrilew
6
Godfather
28. Apr. 2020.
Izgleda da ga nisi stavio lepo unutar switch-a, ide ovako sve:
switch(dialogid)
{
case Broj1:
{
Code;
}
case Broj2:
{
Code;
}
case Broj3:
{
Code;
}
}

//Takodje moras imati i za OnDialogResponse otvoren i zatvoren bracket { }
Teodor
4
Made Man
28. Apr. 2020.
V01D wrote on April 28, 2020, 9:25 am:
Izgleda da ga nisi stavio lepo unutar switch-a, ide ovako sve:
switch(dialogid)
{
case Broj1:
{
Code;
}
case Broj2:
{
Code;
}
case Broj3:
{
Code;
}
}

//Takodje moras imati i za OnDialogResponse otvoren i zatvoren bracket { }

Fix sam sad to, create mi se objecat, mogu da ga editujem i sve, ali mi se ne cuva posle restarta, znas mozda kako to da resim da mi se posle restarta servera sacuvaju ti objecti @V01D

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha