01.07.2013, 07:18
heres my example
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#define MAX_BLOCKS 100
#define Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)
#define ALLBLOCK Loop(i, MAX_BLOCKS)
enum BInfo
{
Float:OffX,
Float:OffY,
Float:OffZ,
Float:RX,
Float:RY,
Float:RZ
}
new BlockInfo[MAX_BLOCKS][BInfo];
new AllBlock[MAX_BLOCKS];
new IsPlayerCreateBlock[MAX_PLAYERS][MAX_BLOCKS];
new BID;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
CMD:createblock(playerid,params[])
{
new type;
if(sscanf(params, "i",type)) return SendClientMessage(playerid,-1,"/createblock <1-5>");
{
new Float:X,Float:Y,Float:Z;
IsPlayerCreateBlock[playerid][BID] = 1;
GetPlayerPos(playerid,X,Y,Z);
CreateDynamicBlock(type,X,Y,Z,0.00,0.00,0.00);
new str[128];
format(str, sizeof(str), "Object Id: %d", BID);
CreatePlayer3DTextLabel(playerid,str,0x008080FF,X,Y,Z,40.0);
}
return 1;
}
stock CreateDynamicBlock(type,Float:X,Float:Y,Float:Z,Float:RotX,Float:RotY,Float:RotZ)
{
if(type == 1)
{
BlockInfo[BID][OffX] = X;
BlockInfo[BID][OffY] = Y;
BlockInfo[BID][OffZ] = Z;
BlockInfo[BID][RX] = RotX;
BlockInfo[BID][RY] = RotX;
BlockInfo[BID][RZ] = RotZ;
AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "red", 0xFFFFFF10);
BID++;
}
if(type == 2)
{
BlockInfo[BID][OffX] = X;
BlockInfo[BID][OffY] = Y;
BlockInfo[BID][OffZ] = Z;
BlockInfo[BID][RX] = RotX;
BlockInfo[BID][RY] = RotX;
BlockInfo[BID][RZ] = RotZ;
AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "green", 0xFFFFFF10);
BID++;
}
if(type == 3)
{
BlockInfo[BID][OffX] = X;
BlockInfo[BID][OffY] = Y;
BlockInfo[BID][OffZ] = Z;
BlockInfo[BID][RX] = RotX;
BlockInfo[BID][RY] = RotX;
BlockInfo[BID][RZ] = RotZ;
AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "orange", 0xFFFFFF10);
BID++;
}
if(type == 4)
{
BlockInfo[BID][OffX] = X;
BlockInfo[BID][OffY] = Y;
BlockInfo[BID][OffZ] = Z;
BlockInfo[BID][RX] = RotX;
BlockInfo[BID][RY] = RotX;
BlockInfo[BID][RZ] = RotZ;
AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "yellow", 0xFFFFFF10);
BID++;
}
else
{
//create black block
BlockInfo[BID][OffX] = X;
BlockInfo[BID][OffY] = Y;
BlockInfo[BID][OffZ] = Z;
BlockInfo[BID][RX] = RotX;
BlockInfo[BID][RY] = RotX;
BlockInfo[BID][RZ] = RotZ;
AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "blue", 0xFFFFFF10);
BID++;
}
return 1;
}