OnPlayerEditAttachedObject problem
#1

So I have recently trying to add objects on players head and try to save the information about the objects using the OnPlayerEditAttachedObject callback which isn't really calling after I am editing any object. Whenever I save the object after I have edited coordinates for the object the OnPlayerEditAttachedObject callback won't call in any moment. I have searched on internet for solutions it says that it requires 0.3e version when I have 0.3x.

Код:
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY,
Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
	SetPlayerAttachedObject(playerid, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);;
	for(new i = 0; i < 15; i++)
	{
		new file[368], name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, sizeof(name));
		if(strcmp(name, oInfo[i][OOwner], true))
		{
			SendClientMessage(playerid, GREEN, "Attached object edition saved.");
			oInfo[i][OffsetX] = fOffsetX;
			oInfo[i][OffsetY] = fOffsetY;
			oInfo[i][OffsetZ] = fOffsetZ;
			oInfo[i][RotX] = fRotX;
			oInfo[i][RotY] = fRotY;
			oInfo[i][RotZ] = fRotZ;
			oInfo[i][ScaleX] = fScaleX;
			oInfo[i][ScaleY] = fScaleY;
			oInfo[i][ScaleZ] = fScaleZ;
			SavePObject(playerid, i);
		}
	}
    return 1;
}
https://sampwiki.blast.hk/wiki/EditAttachedObject

This is the code I use, but anyways whenever I try to save my edited object this callback isn't called when it actually says otherwise in SA-MP wiki. Any help would be appreciated. By the way I am not sure also about my strcmp code tell me if it's right when I try to compare my name with another string, thanks.
Reply
#2

I can tell just by looking at that code you don't know what your doing your not even checking if the player clicked saved I have no idea why your looping through 15 objects the maximum amount is 10 furthermore your setting all the object slots to save your edition.
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
I can tell just by looking at that code you don't know what your doing your not even checking if the player clicked saved I have no idea why your looping through 15 objects the maximum amount is 10 furthermore your setting all the object slots to save your edition.
Doesn't it have to check automatically if player have clicked on save? it says in wiki that when a player clicks on save it calls the callback... Ohh yeah and by the way I am making a object storage for player I mean that player can get 15 objects but there is 10 slots for using the objects I mean that I am not looping the object slots..
Reply
#4

In that case you would need something like...

pawn Код:
if(response)
{
    for(new i = 0; i < 15; i++)
    {
        if(oInfo[i][Enabled] == true) continue;
        oInfo[i][Enabled] = true;
        // Do save code
        break;
    }
    return 1;
}
else SendClientMessage(playerid, -1, "Edit cancelled!");
Reply
#5

Where'd you get [Enabled]? it says it is undefined symbol
Reply
#6

And no it still doesn't call that callback it gives only standard message "You finished editing attached object"
Reply
#7

Derp.... You need to add Enabled to your enum.... and

Derp... Small mistake

pawn Код:
if(response)
{
    for(new i = 0; i < 15; i++)
    {
        if(oInfo[i][Enabled] == true) continue;
        oInfo[i][Enabled] = true;
        // Do save code
        break;
    }
}
else SendClientMessage(playerid, -1, "Edit cancelled!");
return 1;
Reply
#8

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Derp.... You need to add Enabled to your enum.... and

Derp... Small mistake

pawn Код:
if(response)
{
    for(new i = 0; i < 15; i++)
    {
        if(oInfo[i][Enabled] == true) continue;
        oInfo[i][Enabled] = true;
        // Do save code
        break;
    }
}
else SendClientMessage(playerid, -1, "Edit cancelled!");
return 1;
Nope still doesn't call and still the same standard message. Ohh yeah and if(oInfo[i][Enabled] == true) continue; is a tag mismatch so I changed true to a value 1 and tried even 0, but still no luck.
Reply
#9

I have noticed a note in the samp wiki:

Important Note: Editions should be discarded if response was '0' (cancelled). This must be done by storing the offsets etc. in an array BEFORE using EditAttachedObject.

I don't just get it what I have to do. Does this mean that I have to define floats before using EditAttachedObject? For example I do oInfo[i][OffsetX] = 0.000000 before using EditAttachedObject ?
Reply
#10

Bumpp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)