Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------------------------------------|
- // [svText] |
- // |
- // |
- // - You may not remove these credits |
- // - You may not claim this script as yours |
- // |
- // |
- // |
- // [VERSION 1.0] Created by SuperViper |
- //-----------------------------------------------------------------------------------|
- #include <a_samp>
- #define MAX_TEXT MAX_OBJECTS/5
- // ================================================================================ ///
- // DO NOT TOUCH ANYTHING BELOW THIS ///
- // ================================================================================ ///
- forward svText_OnPlayerTouchText(playerid, textID);
- enum e_svText_Text
- {
- bool: svBeingUsed,
- svColor,
- Float: svPosition[4],
- svSize,
- svText[150],
- svFont[20],
- svAlignment,
- svObject,
- svPickup,
- bool: svPlayerObject,
- svPlayer,
- }
- new svText_Text[MAX_TEXT][e_svText_Text], bool: svText_Debugging;
- stock svText_Debug(bool: toggleDebug)
- {
- if(toggleDebug == true)
- {
- print("(svText) Debugging has been turned on");
- }
- else if(toggleDebug == false)
- {
- print("(svText) Debugging has been turned off");
- }
- return svText_Debugging = toggleDebug;
- }
- stock svText_Create3DText(text[], color, Float: posX, Float: posY, Float: posZ, Float: rotX = 0.0, Float: rotY = 0.0, Float: rotZ = 0.0, size = 20, font[] = "Arial", alignment = 0)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Create3DText(text = %s, color = %d, posX = %f, posY = %f, posZ = %f, rotZ = %f, size = %d, font = %s, alignment = %d", text, color ,posX, posY, posZ, rotZ, size, font, alignment);
- }
- new i;
- for(new t = 0; t < MAX_TEXT; t++)
- {
- if(svText_Text[t][svBeingUsed] == false)
- {
- i = t;
- break;
- }
- }
- svText_Text[i][svBeingUsed] = true;
- svText_Text[i][svColor] = color;
- svText_Text[i][svPosition][0] = posX, svText_Text[i][svPosition][1] = posY, svText_Text[i][svPosition][2] = posZ, svText_Text[i][svPosition][3] = rotZ;
- svText_Text[i][svSize] = size;
- svText_Text[i][svAlignment] = alignment;
- format(svText_Text[i][svText], 150, text);
- format(svText_Text[i][svFont], 20, font);
- svText_Text[i][svPlayerObject] = false;
- svText_Text[i][svPickup] = CreatePickup(19300, 23, posX, posY, posZ);
- svText_Text[i][svObject] = CreateObject(19479, posX, posY, posZ, rotX, rotY, rotZ);
- SetObjectMaterialText(svText_Text[i][svObject], text, 0, OBJECT_MATERIAL_SIZE_512x256, font, size, 1, color, 0, alignment);
- return i;
- }
- stock svText_CreatePlayer3DText(playerid, text[], color, Float: posX, Float: posY, Float: posZ, Float: rotX = 0.0, Float: rotY = 0.0, Float: rotZ = 0.0, size = 20, font[] = "Arial", alignment = 0)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) CreatePlayer3DText(playerid = %d, text = %s, color = %d, posX = %f, posY = %f, posZ = %f, rotZ = %f, size = %d, font = %s, alignment = %d", text, color ,posX, posY, posZ, rotZ, size, font, alignment);
- }
- new i;
- for(new t = 0; t < MAX_TEXT; t++)
- {
- if(svText_Text[t][svBeingUsed] == false)
- {
- i = t;
- break;
- }
- }
- svText_Text[i][svBeingUsed] = true;
- svText_Text[i][svColor] = color;
- svText_Text[i][svPosition][0] = posX, svText_Text[i][svPosition][1] = posY, svText_Text[i][svPosition][2] = posZ, svText_Text[i][svPosition][3] = rotZ;
- svText_Text[i][svSize] = size;
- svText_Text[i][svAlignment] = alignment;
- format(svText_Text[i][svText], 150, text);
- format(svText_Text[i][svFont], 20, font);
- svText_Text[i][svPlayerObject] = true;
- svText_Text[i][svPlayer] = playerid;
- svText_Text[i][svPickup] = CreatePickup(19300, 23, posX, posY, posZ);
- svText_Text[i][svObject] = CreatePlayerObject(playerid, 19479, posX, posY, posZ, rotX, rotY, rotZ);
- SetObjectMaterialText(svText_Text[i][svObject], text, 0, OBJECT_MATERIAL_SIZE_512x256, font, size, 1, color, 0, alignment);
- return i;
- }
- stock svText_Destroy3DText(textID)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Destroy3DText(textID = %d)", textID);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- if((svText_Text[textID][svPlayerObject] == false) ? DestroyObject(svText_Text[textID][svObject]) : DestroyPlayerObject(svText_Text[textID][svPlayer], svText_Text[textID][svObject])) { }
- DestroyPickup(svText_Text[textID][svPickup]);
- svText_Text[textID][svBeingUsed] = false;
- }
- return 1;
- }
- stock svText_IsValid3DText(textID)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) IsValid3DText(textID = %d)", textID);
- }
- return svText_Text[textID][svBeingUsed];
- }
- stock svText_Attach3DTextToPlayer(textID, playerid, Float: offsetX = 0.0, Float: offsetY = 0.0, Float: offsetZ = 0.0, Float: offsetRotX = 0.0, Float: offsetRotY = 0.0, Float: offsetRotZ = 0.0)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Attach3DTextToPlayer(textID = %d, playerid = %d, offsetX = %f, offsetY = %f, offsetZ = %f, offsetRotX = %f, offsetRotY = %f, offsetRotZ = %f)", textID, playerid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- if((svText_Text[textID][svPlayerObject] == false) ? AttachObjectToPlayer(svText_Text[textID][svObject], playerid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ) : AttachPlayerObjectToPlayer(svText_Text[textID][svPlayer], svText_Text[textID][svObject], playerid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ)) { }
- }
- return 1;
- }
- stock svText_Attach3DTextToObject(textID, objectid, Float: offsetX = 0.0, Float: offsetY = 0.0, Float: offsetZ = 0.0, Float: offsetRotX = 0.0, Float: offsetRotY = 0.0, Float: offsetRotZ = 0.0)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Attach3DTextToObject(textID = %d, objectid = %d, offsetX = %f, offsetY = %f, offsetZ = %f, offsetRotX = %f, offsetRotY = %f, offsetRotZ = %f)", textID, playerid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- if((svText_Text[textID][svPlayerObject] == false) ? AttachObjectToObject(svText_Text[textID][svObject], objectid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ) : AttachPlayerObjectToObject(svText_Text[textID][svPlayer], svText_Text[textID][svObject], objectid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ)) { }
- }
- return 1;
- }
- stock svText_Attach3DTextToVehicle(textID, vehicleid, Float: offsetX = 0.0, Float: offsetY = 0.0, Float: offsetZ = 0.0, Float: offsetRotX = 0.0, Float: offsetRotY = 0.0, Float: offsetRotZ = 0.0)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Attach3DTextToVehicle(textID = %d, vehicleid = %d, offsetX = %f, offsetY = %f, offsetZ = %f, offsetRotX = %f, offsetRotY = %f, offsetRotZ = %f)", textID, playerid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- if((svText_Text[textID][svPlayerObject] == false) ? AttachObjectToVehicle(svText_Text[textID][svObject], vehicleid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ) : AttachPlayerObjectToVehicle(svText_Text[textID][svPlayer], svText_Text[textID][svObject], vehicleid, offsetX, offsetY, offsetZ, offsetRotX, offsetRotY, offsetRotZ)) { }
- }
- return 1;
- }
- stock svText_Detach3DText(textID)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) svText_DetachText(textID = %d)", textID);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- new Float: textInfo[6];
- DestroyPickup(svText_Text[textID][svPickup]);
- svText_Text[textID][svPickup] = CreatePickup(19300, 23, textInfo[0], textInfo[1], textInfo[2]);
- if(svText_Text[textID][svPlayerObject] == false)
- {
- GetObjectPos(svText_Text[textID][svObject], textInfo[0], textInfo[1], textInfo[2]);
- GetObjectRot(svText_Text[textID][svObject], textInfo[3], textInfo[4], textInfo[5]);
- DestroyObject(svText_Text[textID][svObject]);
- svText_Text[textID][svObject] = CreateObject(19479, textInfo[0], textInfo[1], textInfo[2], textInfo[3], textInfo[4], textInfo[5]);
- SetObjectMaterialText(svText_Text[textID][svObject], svText_Text[textID][svText], 0, OBJECT_MATERIAL_SIZE_512x256, svText_Text[textID][svFont], svText_Text[textID][svSize], 1, svText_Text[textID][svColor], 0, svText_Text[textID][svAlignment]);
- }
- else
- {
- GetPlayerObjectPos(svText_Text[textID][svPlayer], svText_Text[textID][svObject], textInfo[0], textInfo[1], textInfo[2]);
- GetPlayerObjectRot(svText_Text[textID][svPlayer], svText_Text[textID][svObject], textInfo[3], textInfo[4], textInfo[5]);
- DestroyPlayerObject(svText_Text[textID][svPlayer], svText_Text[textID][svObject]);
- svText_Text[textID][svObject] = CreatePlayerObject(svText_Text[textID][svPlayer], 19479, textInfo[0], textInfo[1], textInfo[2], textInfo[3], textInfo[4], textInfo[5]);
- SetPlayerObjectMaterialText(svText_Text[textID][svPlayer], svText_Text[textID][svObject], svText_Text[textID][svText], 0, OBJECT_MATERIAL_SIZE_512x256, svText_Text[textID][svFont], svText_Text[textID][svSize], 1, svText_Text[textID][svColor], 0, svText_Text[textID][svAlignment]);
- }
- }
- return 1;
- }
- stock svText_Move3DText(textID, Float: posX, Float: posY, Float: posZ, Float: speed = 1.0, Float: rotX = -1000.0, Float: rotY = -1000.0, Float: rotZ = -1000.0)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Move3DText(textID = %d, posX = %f, posY = %f, posZ = %f, speed = %f, rotX = %f, rotY = %f, rotZ = %f)", textID, posX, posY, posZ, speed, rotX, rotY, rotZ);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- if((svText_Text[textID][svPlayerObject] == false) ? MoveObject(svText_Text[textID][svObject], posX, posY, posZ, speed, rotX, rotY, rotZ) : MovePlayerObject(svText_Text[textID][svPlayer], svText_Text[textID][svObject], posX, posY, posZ, speed, rotX, rotY, rotZ)) { }
- }
- return 1;
- }
- stock svText_Adjust3DTextData(textID, text[], color = -1, size = -1, font[] = "-1", alignment = -1)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) Adjust3DTextData(textID = %d, text = %s, color = %d, size = %d, font = %s, alignment = %d)", textID, text, color, size, font, alignment);
- }
- if(svText_Text[textID][svBeingUsed] == true)
- {
- format(svText_Text[textID][svText], 150, text);
- if(color > -1)
- {
- svText_Text[textID][svColor] = color;
- }
- if(size > -1)
- {
- svText_Text[textID][svSize] = size;
- }
- if(strcmp(font, "-1"))
- {
- format(svText_Text[textID][svFont], 20, font);
- }
- if(alignment > -1)
- {
- svText_Text[textID][svAlignment] = alignment;
- }
- if(svText_Text[textID][svPlayerObject] == false)
- {
- SetObjectMaterialText(svText_Text[textID][svObject], text, 0, OBJECT_MATERIAL_SIZE_512x256, svText_Text[textID][svFont], svText_Text[textID][svSize], 1, svText_Text[textID][svColor], 0, svText_Text[textID][svAlignment]);
- }
- else
- {
- SetPlayerObjectMaterialText(svText_Text[textID][svPlayer], svText_Text[textID][svObject], text, 0, OBJECT_MATERIAL_SIZE_512x256, svText_Text[textID][svFont], svText_Text[textID][svSize], 1, svText_Text[textID][svColor], 0, svText_Text[textID][svAlignment]);
- }
- }
- return 1;
- }
- stock svText_BeginEditing3DText(playerid, textID)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) BeginEditing3DText(playerid = %d, textID = %d)", playerid, textID);
- }
- return (svText_Text[textID][svPlayerObject] == false) ? EditObject(playerid, svText_Text[textID][svObject]) : EditPlayerObject(svText_Text[textID][svPlayer], svText_Text[textID][svObject]);
- }
- stock svText_StopEditing3DText(playerid)
- {
- if(svText_Debugging == true)
- {
- printf("(svText) StopEditing3DText(playerid = %d)", playerid);
- }
- return CancelEdit(playerid);
- }
- forward svText_OnPlayerPickUpPickup(playerid, pickupid);
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- for(new i = 0; i < MAX_TEXT; i++)
- {
- if(svText_Text[i][svPickup] == pickupid)
- {
- CallRemoteFunction("svText_OnPlayerTouchText", "dd", playerid, i);
- break;
- }
- }
- return CallRemoteFunction("svText_OnPlayerPickUpPickup", "dd", playerid, pickupid);
- }
- #if defined _ALS_OnPlayerPickUpPickup
- #undef OnPlayerPickUpPickup
- #else
- #define _ALS_OnPlayerPickUpPickup
- #endif
- #define OnPlayerPickUpPickup svText_OnPlayerPickUpPickup
- forward svText_OnPlayerEditObject(playerid, playerobject, objectid, response, Float: fX, Float: fY, Float: fZ, Float: fRotX, Float: fRotY, Float: fRotZ);
- public OnPlayerEditObject(playerid, playerobject, objectid, response, Float: fX, Float: fY, Float: fZ, Float: fRotX, Float: fRotY, Float: fRotZ)
- {
- for(new i = 0; i < MAX_TEXT; i++)
- {
- if(svText_Text[i][svObject] == objectid)
- {
- svText_Text[i][svPosition][0] = fX, svText_Text[i][svPosition][1] = fY, svText_Text[i][svPosition][2] = fZ;
- break;
- }
- }
- return 1;
- }
- #if defined _ALS_OnPlayerEditObject
- #undef OnPlayerEditObject
- #else
- #define _ALS_OnPlayerEditObject
- #endif
- #define OnPlayerEditObject svText_OnPlayerEditObject
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement