19.07.2015, 11:39
I have two functions, when I pass through "1" into a function, when it comes out to the other side it comes out as "0" no matter what number I pass it originally.
I've debugged both sides and it's always correct outside of the function and incorrect on the inside.
The bug is in the "MoveDynamicObjectEx" function and the variable is "objectID". No matter what number I pass it, it's value is always 0 inside the function.
I've debugged both sides and it's always correct outside of the function and incorrect on the inside.
Код:
stock MoveMoveableObject(obj[], obj_size){ new MoveableObject[Class_MoveableObject]; Utils_ArrayEqualsArray(MoveableObject, obj, sizeof(MoveableObject), obj_size); if(MoveableObject[bCanBeMoved] == true){ new ObjectID = MoveableObject[objectID]; if(MoveableObject[bIsInStartState] == true){ MoveDynamicObjectEx(ObjectID, MoveableObject[endLocation], MoveableObject[endRotation], 3.0); MoveableObject[bIsInStartState] = false; new debugString[128]; format(debugString, sizeof(debugString), "ObjectID: %d", ObjectID); SendClientMessageToAll(0xFFFFFF, debugString); } else { MoveDynamicObjectEx(ObjectID, MoveableObject[startLocation], MoveableObject[startRotation], 3.0); MoveableObject[bIsInStartState] = true; } Utils_ArrayEqualsArray(obj, MoveableObject, sizeof(MoveableObject), obj_size); } else { return; } }
Код:
stock MoveDynamicObjectEx(objectID, loc_vec[], rot_vec[], speed){ new debugString[128]; format(debugString, sizeof(debugString), "ObjectID: %d || LocX: %f || LocY: %f || LocZ: %f || Speed: %f ((IsMoving: %b))", objectID, loc_vec[x], loc_vec[y], loc_vec[z], speed, IsObjectMoving(objectID)); SendClientMessageToAll(0xFFFFFF, debugString); MoveDynamicObject(2, loc_vec[x], loc_vec[y], loc_vec[z], speed, rot_vec[x], rot_vec[y], rot_vec[z]); }