Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define MAX_OBJ 403
- new ObjNum;
- new RT[MAX_PLAYERS];
- enum ObjInfo
- {
- modelid,
- Float:X,
- Float:Y,
- Float:Z,
- Float:rX,
- Float:rY,
- Float:rZ,
- Float:DrawDistance,
- Float:mX,
- Float:mY,
- Float:mZ,
- Float:Xrm,
- Float:Yrm,
- Float:Zrm,
- Float:SpeedD,
- bool:Rotated,
- bool:Moved,
- bool:Exists,
- bool:Created[MAX_PLAYERS],
- iD[MAX_PLAYERS]
- };
- new ObjVar[MAX_OBJ][ObjInfo];
- stock DucK_CreateObject(modelido, Float:Xo, Float:Yo, Float:Zo, Float:rXo, Float:rYo, Float:rZo, Float:DrawDistanceo = 200.0)
- {
- ObjNum++;
- ObjVar[ObjNum][modelid] = modelido;
- ObjVar[ObjNum][X] = Xo;
- ObjVar[ObjNum][Y] = Yo;
- ObjVar[ObjNum][Z] = Zo;
- ObjVar[ObjNum][rX] = rXo;
- ObjVar[ObjNum][rY] = rYo;
- ObjVar[ObjNum][rZ] = rZo;
- ObjVar[ObjNum][DrawDistance] = DrawDistanceo;
- ObjVar[ObjNum][Exists] = true;
- if(ObjNum == MAX_OBJ-1) printf("..>> DucK Streamer: ERROR - #define MAX_OBJ Is Too Low.\n..>> DucK Streamer: Only First %d Objects Were Created.", MAX_OBJ+1);
- return ObjNum;
- }
- stock DucK_RemoveObject(Objectid)
- {
- ObjVar[Objectid][Exists] = false;
- }
- stock DucK_MoveObject(Objectid, Float:Xm, Float:Ym, Float:Zm, Float:SpeedDm = 2.5, Float:RotXm = -1000.0, Float:RotYm = -1000.0, Float:RotZm = -1000.0)
- {
- if(ObjVar[Objectid][Exists])
- {
- if(RotXm == -1000.0) RotXm = ObjVar[Objectid][Xrm];
- if(RotYm == -1000.0) RotYm = ObjVar[Objectid][Yrm];
- if(RotZm == -1000.0) RotZm = ObjVar[Objectid][Zrm];
- ObjVar[Objectid][mX] = Xm;
- ObjVar[Objectid][mY] = Ym;
- ObjVar[Objectid][mZ] = Zm;
- ObjVar[Objectid][Xrm] = RotXm;
- ObjVar[Objectid][Yrm] = RotYm;
- ObjVar[Objectid][Zrm] = RotZm;
- ObjVar[Objectid][SpeedD] = SpeedDm;
- ObjVar[Objectid][Moved] = true;
- ObjVar[Objectid][Rotated] = true;
- }
- }
- stock DucK_RotateObject(Objectid, Float:RotX, Float:RotY, Float:RotZ)
- {
- if(ObjVar[Objectid][Exists])
- {
- ObjVar[Objectid][Xrm] = RotXm;
- ObjVar[Objectid][Yrm] = RotYm;
- ObjVar[Objectid][Zrm] = RotZm;
- ObjVar[Objectid][Rotated] = true;
- }
- }
- stock DucK_ReturnObject(Objectid)
- {
- ObjVar[Objectid][Rotated] = false;
- ObjVar[Objectid][Moved] = false;
- }
- forward RefreshObjects(playerid);
- public RefreshObjects(playerid)
- {
- for(new i; i < ObjNum; i++)
- {
- if(ObjVar[i][Exists])
- {
- if(IsPlayerInRangeOfPoint(playerid, ObjVar[i][DrawDistance], ObjVar[i][X], ObjVar[i][Y], ObjVar[i][Z]))
- {
- if(!ObjVar[i][Created][playerid])
- {
- ObjVar[i][iD][playerid] = CreatePlayerObject(playerid, ObjVar[i][modelid], ObjVar[i][X], ObjVar[i][Y], ObjVar[i][Z], ObjVar[i][rX], ObjVar[i][rY], ObjVar[i][rZ], ObjVar[i][DrawDistance]);
- if(ObjVar[i][Moved])
- {
- MoveObject(ObjVar[i][iD][playerid], ObjVar[i][mX], ObjVar[i][mY], ObjVar[i][mZ], ObjVar[i][SpeedD], ObjVar[i][Xrm], ObjVar[i][Yrm], ObjVar[i][Zrm]);
- }
- if(ObjVar[i][Rotated])
- {
- SetObjectRot(ObjVar[i][iD][playerid], ObjVar[i][Xrm], ObjVar[i][Yrm], ObjVar[i][Zrm]);
- }
- }
- }
- else
- {
- if(ObjVar[i][Created][playerid])
- {
- DestroyPlayerObject(playerid, ObjVar[i][iD][playerid]);
- }
- }
- }
- else if(!ObjVar[i][Exists])
- {
- DestroyPlayerObject(playerid, ObjVar[i][iD][playerid]);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment