PDA

View Full Version : Function not running


aoky
20/07/2017, 11:48 AM
Rack_Refresh(rackid)
{
if (rackid != -1 && RackData[rackid][rackExists])
{
static
str[64];

if (IsValidDynamicObject(RackData[rackid][rackObjects][4])) {
DestroyDynamicObject(RackData[rackid][rackObjects][4]);
}
if (IsValidDynamic3DTextLabel(RackData[rackid][rackText3D])) {
DestroyDynamic3DTextLabel(RackData[rackid][rackText3D]);
}
format(str, sizeof(str), "[Rack %d]\n{FFFFFF}/gunrack to use this rack.", rackid);
RackData[rackid][rackText3D] = CreateDynamic3DTextLabel(str, COLOR_DARKBLUE, RackData[rackid][rackPos][0], RackData[rackid][rackPos][1], RackData[rackid][rackPos][2] + 1.2, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, RackData[rackid][rackWorld], RackData[rackid][rackInterior]);

Rack_RefreshGuns(rackid);
RackData[rackid][rackObjects][4] = CreateDynamicObject(2475, RackData[rackid][rackPos][0], RackData[rackid][rackPos][1], RackData[rackid][rackPos][2], 0.0, 0.0, RackData[rackid][rackPos][3], RackData[rackid][rackWorld], RackData[rackid][rackInterior]);
printf("rack id = %i", rackid);
}
return 1;
}

This code isn't running, I debugged it and it was actually running the rack ID you're editing but it doesn't change the location. Any ideas why?

Runn3R
20/07/2017, 12:54 PM
Instead of destroying why don't you try simply moving the object to another place?
It would request less code than this.

aoky
20/07/2017, 12:55 PM
It doesn't even delete the object, the code doesn't physically run. Not sure why.

Abagail
20/07/2017, 02:33 PM
How do you know the code doesn't run? Are you sure it's actually being called? Also, are you using the crashdetect plugin?