[HELP] OnPlayerEditDynamicObject not being called
#1

Running 0.3.7
OnPlayerEditObject is not a callback in my gamemode.
Running latest streamer

PHP код:
public OnPlayerEditDynamicObject(playeridobjectidresponseFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz)
{
    if(
response == EDIT_RESPONSE_FINAL)
    {
        print(
"is this even being called?");
        if(
GetPVarInt(playerid"EditingAGate") == 1)
        {
            
Gates[objectid][GateX] = x;
            
Gates[objectid][GateY] = y;
            
Gates[objectid][GateZ] = z;
            
Gates[objectid][GateRX] = rx;
            
Gates[objectid][GateRY] = ry;
            
Gates[objectid][GateRZ] = rz;
            
DestroyDynamicObject(Gates[objectid][GateID]);
            
Gates[objectid][GateID] = CreateDynamicObject(Gates[objectid][GateModel], Gates[objectid][GateX], Gates[objectid][GateY], Gates[objectid][GateZ], Gates[objectid][GateVW], Gates[objectid][GateInt], 0, -1, -1, -1150.0);
            
SetPVarInt(playerid"EditingAGate"0);
            
SaveGate(objectid);
            print(
"yes?");
        }
        if(
GetPVarInt(playerid"EditingAGate") == 2)
        {
            
Gates[objectid][GateXM] = x;
            
Gates[objectid][GateYM] = y;
            
Gates[objectid][GateZM] = z;
            
Gates[objectid][GateRXM] = rx;
            
Gates[objectid][GateRYM] = ry;
            
Gates[objectid][GateRZM] = rz;
            
DestroyDynamicObject(Gates[objectid][GateID]);
            
Gates[objectid][GateID] = CreateDynamicObject(Gates[objectid][GateModel], Gates[objectid][GateX], Gates[objectid][GateY], Gates[objectid][GateZ], Gates[objectid][GateVW], Gates[objectid][GateInt], 0, -1, -1, -1150.0);
            
SetPVarInt(playerid"EditingAGate"0);
            
SaveGate(objectid);
            print(
"ok wtf");
        }
    }
    return 
1;

If you're wondering:

PHP код:
                else if(strcmp(Usage"SpawnPosition"true) == 0)
                {
                    
DestroyDynamicObject(Gates[id][GateID]);
                    
Gates[id][GateID] = CreateDynamicObject(Gates[id][GateModel], Gates[id][GateX], Gates[id][GateY], Gates[id][GateZ], Gates[id][GateVW], Gates[id][GateInt], 0, -1, -1, -1150.0);
                    
                    
EditDynamicObject(playeridGates[id][GateID]);
                    
SetPVarInt(playerid"EditingAGate"1);
                       return 
1;
                }
                else if(
strcmp(Usage"MovePosition"true) == 0)
                {
                    
DestroyDynamicObject(Gates[id][GateID]);
                    
Gates[id][GateID] = CreateDynamicObject(Gates[id][GateModel], Gates[id][GateX], Gates[id][GateY], Gates[id][GateZ], Gates[id][GateVW], Gates[id][GateInt], 0, -1, -1, -1150.0);
                    
EditDynamicObject(playeridGates[id][GateID]);
                    
SetPVarInt(playerid"EditingAGate"2);
                       return 
1;
                } 
is the code where I use EditDynamicObject
Reply
#2

Wrongfully hooking a callback is one of the reasons your callback is not getting called at all, redownload includes that might have hooked this callback (or just re-download them all), that will help.
And btw put your "is this even being called" at first line without any checks, to see if it actually does, not under response final.
Reply
#3

Edit: woops, page didn't load, thought the comment didn't get posted.
Reply
#4

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Wrongfully hooking a callback is one of the reasons your callback is not getting called at all, redownload includes that might have hooked this callback (or just re-download them all), that will help.
And btw put your "is this even being called" at first line without any checks, to see if it actually does, not under response final.
Already tried that and I am running the latest version of Streamer. However, when I removed my server mapping (in a filterscript) it automatically started working again. For some reason having streamer included in two files running at the same time isn't working.
Reply
#5

Sorry for the early bump, but I tried hooking it through y_hooks but it didn't work. Just wanted to clarify: Not sure why loading a filterscript with streamer included breaks this callback but if someone has an answer please let me know.
Reply
#6

This probably isn't the case, but it might be because you don't have a OnPlayerEditDynamicObject in your filterscript (or have one that returns 0) try adding it with a simple return 1 or remove it in fs if you have it, see if it helps.
Reply
#7

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
This probably isn't the case, but it might be because you don't have a OnPlayerEditDynamicObject in your filterscript (or have one that returns 0) try adding it with a simple return 1 or remove it in fs if you have it, see if it helps.
Nope, adding it with return 1 doesn't work. I've tried to add it to my filterscript, and hook the function through the main script with y_hooks.

I've tried everything, and I am not the only one who's had this issue. Removing the filterscript magicially makes it call again it's annoying.
Reply
#8

Here is how I fixed it for ANYONE having this god forsaken issue:

Open the filterscript .pwn in which the callback is calling in (make sure you figure out every filterscript it's calling in)

Then, add the callback into your filterscript like so:

PHP код:
public OnPlayerEditDynamicObject(playeridobjectidresponseFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz// calling fix, don't remove.
{
    
// make sure it doesn't return anything

Then add

PHP код:
CallRemoteFunction("OnPlayerEditGate""iddffffff"playeridobjectidresponseFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz); 
Make sure you add OnPlayerEditGate to your script after you compile like so:

PHP код:
forward OnPlayerEditGate(playeridobjectidresponseFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz); 
Then, add OnPlayerEditGate above OnPlayerEditDynamicObject in the main script:

PHP код:
public OnPlayerEditGate(playeridobjectidresponseFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz)
{
    
// also should not return anything

Then, we're adding the same line except using a different function

PHP код:
CallLocalFunction("OnPlayerEditDynamicObject""iddffffff"playeridobjectidresponseFloat:xFloat:yFloat:zFloat:rxFloat:ryFloat:rz); 
And then, it should work! (Make sure you restart your server - even if you unload/load your filterscript then GMX the gamemode it will still not work)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)