02.04.2019, 07:09
Hey guys.. I have a problem.. I have spraytag system and gate system on
But the thing is when I create a gate ingame it getting merge with spraytag...
I dont know how to fix this..
heres the codes
Code:
public OnPlayerEditDynamicObject
I dont know how to fix this..
heres the codes
Code:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { new string[128], idx = gEditID[playerid]; if(response == EDIT_RESPONSE_UPDATE) { SetDynamicObjectPos(objectid, x, y, z); SetDynamicObjectRot(objectid, rx, ry, rz); } else if(response == EDIT_RESPONSE_CANCEL) { if(gEdit[playerid] == 1) { SetDynamicObjectPos(objectid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]); SetDynamicObjectRot(objectid, gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]); gPos[playerid][0] = 0; gPos[playerid][1] = 0; gPos[playerid][2] = 0; gRot[playerid][0] = 0; gRot[playerid][1] = 0; gRot[playerid][2] = 0; format(string, sizeof(string), " You have canceled editing gate ID %d.", idx); SendClientMessage(playerid, COLOR_WHITE, string); } else if(gEdit[playerid] == 2) { SetDynamicObjectPos(objectid, gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]); SetDynamicObjectRot(objectid, gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]); gPos[playerid][0] = 0; gPos[playerid][1] = 0; gPos[playerid][2] = 0; gRot[playerid][0] = 0; gRot[playerid][1] = 0; gRot[playerid][2] = 0; format(string, sizeof(string), " You have canceled editing gate ID %d.", idx); SendClientMessage(playerid, COLOR_WHITE, string); } } else if(response == EDIT_RESPONSE_FINAL) { SetDynamicObjectPos(objectid, x, y, z); SetDynamicObjectRot(objectid, rx, ry, rz); if(gEdit[playerid] == 1) { GateInfo[idx][gCX] = x; GateInfo[idx][gCY] = y; GateInfo[idx][gCZ] = z; GateInfo[idx][gCRX] = rx; GateInfo[idx][gCRY] = ry; GateInfo[idx][gCRZ] = rz; // if(IsValidDynamic3DTextLabel(GateInfo[idx][gText])) DestroyDynamic3DTextLabel(GateInfo[idx][gText]); format(string, sizeof(string), "Gate ID: %d", idx); // GateInfo[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], 10); gEdit[playerid] = 0; gEditID[playerid] = 0; format(string, sizeof(string), " You have finished editing gate ID %d's closing position.", idx); SendClientMessage(playerid, COLOR_WHITE, string); GateInfo[idx][gStatus] = 0; } else if(gEdit[playerid] == 2) { GateInfo[idx][gOX] = x; GateInfo[idx][gOY] = y; GateInfo[idx][gOZ] = z; GateInfo[idx][gORX] = rx; GateInfo[idx][gORY] = ry; GateInfo[idx][gORZ] = rz; gEdit[playerid] = 0; gEditID[playerid] = 0; format(string, sizeof(string), " You have finished editing gate ID %d's opening position.", idx); SendClientMessage(playerid, COLOR_WHITE, string); GateInfo[idx][gStatus] = 1; } } new pName[MAX_PLAYER_NAME]; if(response == EDIT_RESPONSE_FINAL) { if(IsPlayerModifyingTag[playerid] == false) { gFreeTagSlot = GetFreeTagSlot(); if(gFreeTagSlot > HighestTagID) HighestTagID++; GetPlayerName(playerid, pName, sizeof(pName)); TagData[gFreeTagSlot][eTagID] = gFreeTagSlot; TagData[gFreeTagSlot][eTaggerName] = pName; TagData[gFreeTagSlot][eTagText] = gPlayerTagText[playerid]; TagData[gFreeTagSlot][eTagFont] = gPlayerTagFont[playerid]; TagData[gFreeTagSlot][eTagSize] = gPlayerTagSize[playerid]; TagData[gFreeTagSlot][eTagTextColor] = gPlayerTagTextColor[playerid]; TagData[gFreeTagSlot][eTagBold] = gPlayerTagBold[playerid]; TagData[gFreeTagSlot][eTagPos][0] = x; TagData[gFreeTagSlot][eTagPos][1] = y; TagData[gFreeTagSlot][eTagPos][2] = z; TagData[gFreeTagSlot][eTagPos][3] = rx; TagData[gFreeTagSlot][eTagPos][4] = ry; TagData[gFreeTagSlot][eTagPos][5] = rz; SaveTag(gFreeTagSlot); DestroyDynamicObject(gPlayerTagObject[playerid]); gPlayerTagObject[playerid] = INVALID_OBJECT_ID; gTagObject[gFreeTagSlot] = CreateDynamicObject(19482, x, y, z, rx, ry, rz); SetDynamicObjectMaterialText(gTagObject[gFreeTagSlot], 0, gPlayerTagText[playerid], OBJECT_MATERIAL_SIZE_256x256, gPlayerTagFont[playerid], gPlayerTagSize[playerid], gPlayerTagBold[playerid], gPlayerTagTextColor[playerid], 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); // format(gTagLabelText[gFreeTagSlot], 5, "%d", gFreeTagSlot); // gTagLabel[gFreeTagSlot] = CreateDynamic3DTextLabel(gTagLabelText[gFreeTagSlot], 0xE8E8E8FF, TagData[gFreeTagSlot][eTagPos][0], TagData[gFreeTagSlot][eTagPos][1], TagData[gFreeTagSlot][eTagPos][2], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0); Streamer_Update(playerid); //PlayerInfo[playerid][pSpray] -= 1; ApplyAnimation(playerid, "SPRAYCAN", "spraycan_full", 4.0, 0, 0, 0, 0, 0); PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0); SendClientMessage(playerid, ~1, "The spraytag has been saved."); IsTagIDUsed[gFreeTagSlot] = true; IsPlayerInTagEdit[playerid] = false; PlayerInfo[playerid][pSpraytag] --; } else if(IsPlayerModifyingTag[playerid] == true) { TagData[gPlayerTagIndex[playerid]][eTagPos][0] = x; TagData[gPlayerTagIndex[playerid]][eTagPos][1] = y; TagData[gPlayerTagIndex[playerid]][eTagPos][2] = z; TagData[gPlayerTagIndex[playerid]][eTagPos][3] = rx; TagData[gPlayerTagIndex[playerid]][eTagPos][4] = ry; TagData[gPlayerTagIndex[playerid]][eTagPos][5] = rz; SaveTag(gPlayerTagIndex[playerid], 1); SetDynamicObjectMaterialText(objectid, 0, TagData[gPlayerTagIndex[playerid]][eTagText], OBJECT_MATERIAL_SIZE_256x256, TagData[gPlayerTagIndex[playerid]][eTagFont], TagData[gPlayerTagIndex[playerid]][eTagSize], TagData[gPlayerTagIndex[playerid]][eTagBold], TagData[gPlayerTagIndex[playerid]][eTagTextColor], 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); ApplyAnimation(playerid, "SPRAYCAN", "spraycan_full", 4.0, 0, 0, 0, 0, 0); PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0); SendClientMessage(playerid, ~1, "The spraytag has been saved."); IsPlayerModifyingTag[playerid] = false; PlayerInfo[playerid][pSpraytag] --; } } else if(response == EDIT_RESPONSE_CANCEL) { if(IsPlayerModifyingTag[playerid] == false) { DestroyDynamicObject(gPlayerTagObject[playerid]); gPlayerTagObject[playerid] = INVALID_OBJECT_ID; SendClientMessage(playerid, ~1, "The spraytag has been canceled/removed."); IsPlayerInTagEdit[playerid] = false; } else if(IsPlayerModifyingTag[playerid] == true) { new str3[128]; SaveTag(gPlayerTagIndex[playerid], 2); SetDynamicObjectMaterialText(objectid, 0, TagData[gPlayerTagIndex[playerid]][eTagText], OBJECT_MATERIAL_SIZE_256x256, TagData[gPlayerTagIndex[playerid]][eTagFont], TagData[gPlayerTagIndex[playerid]][eTagSize], TagData[gPlayerTagIndex[playerid]][eTagBold], TagData[gPlayerTagIndex[playerid]][eTagTextColor], 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER); ApplyAnimation(playerid, "SPRAYCAN", "spraycan_full", 4.0, 0, 0, 0, 0, 0); PlayerPlaySound(playerid, 1134, 0.0, 0.0, 0.0); //SendClientMessage(playerid, ~1, "The spraytag has been saved. (no replace)"); IsPlayerModifyingTag[playerid] = false; format(string, sizeof(string), "The spraytag has been saved. (no replace)"); SendClientMessageEx(playerid, ~1,str3); PlayerInfo[playerid][pSpraytag] --; } } return 1; }