SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/04/2019, 08:25 PM   #1
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 685
Reputation: 43
Default Problem with OnPlayerEditDynamicObject

I am creating a dynamic gate system and placing them works. Opening works and the automatic closing after x seconds also works.
Now when I instantly edit the gate after creating it, it is fine. But when I restart the server and the gates are loaded by the script, I can edit them, but after clicking save, it doesn't call OnPlayerEditDynamicObject. Then if I create a new gate next to it, I can still edit it and OnPlayerEditDynamicObject is getting called. Until server restart.

This is my code:
PHP Code:
//Adding a gate:
        
ServerGates[id][GateObject] = CreateDynamicObject(ServerGates[id][GateModel], ServerGates[id][GatePosX]-1.0ServerGates[id][GatePosY]-1.0ServerGates[id][GatePosZ], ServerGates[id][GateRotX], ServerGates[id][GateRotY], ServerGates[id][GateRotZ]);
        
EditDynamicObject(playeridServerGates[id][GateObject]);
//Editing a gate uses this line
EditDynamicObject(playeridServerGates[id][GateObject]);
//Loading gates
LoadServerGates()
{
    new 
DBResult:LOAD_GATES_RESULTS;
    new 
szQuery[256], gatecount 0;
    for(new 
0;d<MAX_GATES;d++)
    {
        new 
id d;
        
format(szQuerysizeof(szQuery), "SELECT * FROM `GATES` WHERE `ID` = '%d'"id);
        
LOAD_GATES_RESULTS db_query(ZARP_DATABASEszQuery);
        if(
db_num_rows(LOAD_GATES_RESULTS))
        {
            
ServerGates[id][GateWorld] = db_get_field_assoc_int(LOAD_GATES_RESULTS"WORLD");
            
ServerGates[id][GateInterior] = db_get_field_assoc_int(LOAD_GATES_RESULTS"INTERIOR");
            
ServerGates[id][GateModel] = db_get_field_assoc_int(LOAD_GATES_RESULTS"MODELID");
            
ServerGates[id][GatePosX] = db_get_field_assoc_float(LOAD_GATES_RESULTS"POSX");
            
ServerGates[id][GatePosY] = db_get_field_assoc_float(LOAD_GATES_RESULTS"POSY");
            
ServerGates[id][GatePosZ] = db_get_field_assoc_float(LOAD_GATES_RESULTS"POSZ");
            
ServerGates[id][GateRotX] = db_get_field_assoc_float(LOAD_GATES_RESULTS"ROTX");
            
ServerGates[id][GateRotY] = db_get_field_assoc_float(LOAD_GATES_RESULTS"ROTY");
            
ServerGates[id][GateRotZ] = db_get_field_assoc_float(LOAD_GATES_RESULTS"ROTZ");
            
ServerGates[id][GateOPosX] = db_get_field_assoc_float(LOAD_GATES_RESULTS"OPOSX");
            
ServerGates[id][GateOPosY] = db_get_field_assoc_float(LOAD_GATES_RESULTS"OPOSY");
            
ServerGates[id][GateOPosZ] = db_get_field_assoc_float(LOAD_GATES_RESULTS"OPOSZ");
            
ServerGates[id][GateORotX] = db_get_field_assoc_float(LOAD_GATES_RESULTS"OROTX");
            
ServerGates[id][GateORotY] = db_get_field_assoc_float(LOAD_GATES_RESULTS"OROTY");
            
ServerGates[id][GateORotZ] = db_get_field_assoc_float(LOAD_GATES_RESULTS"OROTZ");
            
ServerGates[id][GateObject] = CreateDynamicObject(ServerGates[id][GateModel], ServerGates[id][GatePosX], ServerGates[id][GatePosY], ServerGates[id][GatePosZ], ServerGates[id][GateRotX], ServerGates[id][GateRotY], ServerGates[id][GateRotZ]);
             
gatecount++;
        }
    }
    
printf("Gates loaded: %d out of %d"gatecountMAX_GATES);
    
db_free_result(LOAD_GATES_RESULTS);
      return 
1;

What is causing this? The object is there, I can edit it's position and it even saves it position after saving but OnPlayerEditDynamicObject is not getting called.
jasperschellekens is offline   Reply With Quote
Old 16/04/2019, 10:20 PM   #2
FireBoy89
Little Clucker
 
Join Date: Mar 2019
Location: Earth
Posts: 12
Reputation: 3
Default Re: Problem with OnPlayerEditDynamicObject

I guess you have to take a look on this

https://github.com/samp-incognito/sa...ugin/issues/31
https://github.com/samp-incognito/sa...gin/issues/262

However could you post list of plugins that's you are using (OnPlayerEditDynamicObject callback aswell)? Conflicts between sampGDK version would broke both plugins.

also what linux distribution you are using (in your vps)?

EDIT: and if possible 10 or 5 lines that's come before the second "EditDynamicObject..."
FireBoy89 is offline   Reply With Quote
Old 17/04/2019, 06:16 PM   #3
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 685
Reputation: 43
Default Re: Problem with OnPlayerEditDynamicObject

Thanks for your reply. I searched a bit and stumbled onto this:
https://github.com/samp-incognito/sa...ugin/issues/17
Apparently this is caused by having a filterscript that uses streamer. It works fine after I remove the fs may anyone run into this problem.
jasperschellekens is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnPlayerEditDynamicObject Problem MRM Scripting Help 2 16/09/2018 11:17 AM
Problem with response ; OnPlayerEditDynamicObject Chipardeur Scripting Help 7 20/07/2017 02:25 PM
Problem with OnPlayerEditDynamicObject vinnythebest Server Support 0 10/05/2017 01:25 PM
OnPlayerEditDynamicObject Problem sampkinq Scripting Help 1 09/06/2016 09:38 AM
OnPlayerEditDynamicObject - Problem Phil_Cutcliffe Scripting Help 4 24/02/2014 02:55 AM


All times are GMT. The time now is 12:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.