01.06.2012, 13:32
place an object on the ground and then change its mat to text!
heres some functions i wrote just for testing this sort of thing,
I dont have time to explain them but the code should be clear,
use at your own free will, sale it, edit it, give it away lol.
the last one will set the text on an obj
use /cobj to create the obj
/eobj to et the position
/mobj to set the mat text
heres some functions i wrote just for testing this sort of thing,
I dont have time to explain them but the code should be clear,
use at your own free will, sale it, edit it, give it away lol.
the last one will set the text on an obj
pawn Код:
//objects!!!!!!
YCMD:cobj(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/cobj : create an obj");}
else
{
new modelid = strval(params),
Float:x,
Float:y,
Float:z,
Float:rx = 0.0,
Float:ry = 0.0,
Float:rz = 0.0,
objId;
GetPlayerPos(playerid,x,y,z);
//objId = CreateDynamicObject(modelid, x, y, z, rx, ry, rz);
objId = CreateObject(modelid, x + 1.0, y, z, rx, ry, rz);
new strOut[128];
format(strOut,128,"ObjID (%d) Created:",objId);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:sobjx(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/sobjz [objId] [Float:x]: set objects x pos");}
else
{
new objectid,
Float:param_x,
Float:x,
Float:y,
Float:z;
if (sscanf(params,"if",objectid,param_x)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjx [objId] [Float:x]: set objects x pos");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjx [objId] [Float:x]: Invalid objId");
GetObjectPos(objectid, x, y, z);
x += param_x;
SetObjectPos(objectid, x, y, z);
new strOut[128];
format(strOut,128,"ObjID (%d) x Set to (%.02f):",objectid,x);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:sobjy(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/sobjy [objId] [Float:y]: set objects y pos");}
else
{
new objectid,
Float:param_y,
Float:x,
Float:y,
Float:z;
if (sscanf(params,"if",objectid,param_y)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjy [objId] [Float:y]: set objects y pos");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjy [objId] [Float:y]: Invalid objId");
GetObjectPos(objectid, x, y, z);
y += param_y;
SetObjectPos(objectid, x, y, z);
new strOut[128];
format(strOut,128,"ObjID (%i) y Set to (%.02f):",objectid,y);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:sobjz(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/sobjz [objId] [Float:z]: set objects z pos");}
else
{
new objectid,
Float:param_z,
Float:x,
Float:y,
Float:z;
if (sscanf(params,"if",objectid,param_z)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjz [objId] [Float:z]: set objects z pos");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjz [objId] [Float:z]: Invalid objId");
GetObjectPos(objectid, x, y, z);
z += param_z;
SetObjectPos(objectid, x, y, z);
new strOut[128];
format(strOut,128,"ObjID (%i) z Set to (%.02f):",objectid,z);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:sobjrx(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/sobjrz [objId] [Float:rx]: set objects rx pos");}
else
{
new objectid,
Float:param_rx,
Float:rx,
Float:ry,
Float:rz;
if (sscanf(params,"if",objectid,param_rx)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjrx [objId] [Float:rx]: set objects rx pos");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjrx [objId] [Float:rx]: Invalid objId");
GetObjectRot(objectid, rx, ry, rz);
rx += param_rx;
SetObjectRot(objectid, rx, ry, rz);
new strOut[128];
format(strOut,128,"ObjID (%i) rx Set to (%.02f):",objectid,rx);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:sobjry(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/sobjry [objId] [Float:ry]: set objects ry pos");}
else
{
new objectid,
Float:param_ry,
Float:rx,
Float:ry,
Float:rz;
if (sscanf(params,"if",objectid,param_ry)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjry [objId] [Float:ry]: set objects ry pos");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjry [objId] [Float:ry]: Invalid objId");
GetObjectRot(objectid, rx, ry, rz);
ry += param_ry;
SetObjectRot(objectid, rx, ry, rz);
new strOut[128];
format(strOut,128,"ObjID (%i) ry Set to (%.02f):",objectid,ry);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:sobjrz(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/sobjrz [objId] [Float:rz]: set objects rz pos");}
else
{
new objectid,
Float:param_rz,
Float:rx,
Float:ry,
Float:rz;
if (sscanf(params,"if",objectid,param_rz)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjrz [objId] [Float:rz]: set objects rz pos");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/sobjrz [objId] [Float:rz]: Invalid objId");
GetObjectRot(objectid, rx, ry, rz);
rz += param_rz;
SetObjectRot(objectid, rx, ry, rz);
new strOut[128];
format(strOut,128,"ObjID (%i) rz Set to (%.02f):",objectid,rz);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:dobj(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/dobj [objId] : delete an object");}
else
{
new objectid;
if (sscanf(params,"i",objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/dobj [objId] : delete an object");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/dobj [objId] : Invalid objId");
DestroyObject(objectid);
new strOut[128];
format(strOut,128,"ObjID (%i) Deleted",objectid);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:eobj(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/eobj [objId] : edit an object");}
else
{
new objectid;
if (sscanf(params,"i",objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/eobj [objId] : edit an object");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/eobj [objId] : Invalid objId");
EditObject(playerid, objectid);
new strOut[128];
format(strOut,128,"ObjID (%i) editing",objectid);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
YCMD:mobj(playerid, params[], help)
{
//#pragma unused params
if (help) {SendClientMessage(playerid, 0xFF9933FF, "/mobj [objId][text] : ");}
else
{
new objectid,strIn[128];
if (sscanf(params,"is[128]",objectid,strIn)) return SendClientMessage(playerid, 0xFF9933FF, "/mobj [objId][text] : ");
if (!IsValidObject(objectid)) return SendClientMessage(playerid, 0xFF9933FF, "/mobj [objId][text] : Invalid objId");
//new myobject = CreateObject(19353, 0, 0, 10, 0.0, 0.0, 90.0); //create the object
SetObjectMaterialText
(
objectid,
strIn,
0,
OBJECT_MATERIAL_SIZE_512x512 ,
"Arial",
28,
0,
0xFFFF8200, //argb
0xFF000000, //argb
OBJECT_MATERIAL_TEXT_ALIGN_CENTER
);
new strOut[128];
format(strOut,128,"ObjID (%i) mat updated",objectid);
SendClientMessage(playerid, 0xFF9933FF, strOut);
}
return 1;
}
/eobj to et the position
/mobj to set the mat text