Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #define MAX_DYN_OBJECTS 1000
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Streamer на Pawn by Caypen v0.1.3");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- new DynObjects;
- enum ObjInf
- {
- stream_modelid2,
- Float:stream_X2,
- Float:stream_Y2,
- Float:stream_Z2,
- Float:rstream_X2,
- Float:rstream_Y2,
- Float:rstream_Z2,
- Float:stream_DrawDistance2
- };
- new Oinf[MAX_DYN_OBJECTS][ObjInf];
- new timerupdate[MAX_PLAYERS];
- CreateDynObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0)
- {
- if(DynObjects >= MAX_DYN_OBJECTS-1) return INVALID_OBJECT_ID;
- new rands = AddObject();
- Oinf[rands][stream_modelid2] = modelid;
- Oinf[rands][stream_X2] = X;
- Oinf[rands][stream_Y2] = Y;
- Oinf[rands][stream_Z2] = Z;
- Oinf[rands][rstream_X2] = rX;
- Oinf[rands][rstream_Y2] = rY;
- Oinf[rands][rstream_Z2] = rZ;
- Oinf[rands][stream_DrawDistance2] = DrawDistance;
- DynObjects ++;
- return rands;
- }
- static streamer__CreatedForPlayerFlag[MAX_PLAYERS][MAX_DYN_OBJECTS char];
- forward UpdateObjects(player);
- public UpdateObjects(player)
- {
- for(new obj = 0;obj < MAX_DYN_OBJECTS;obj++)
- {
- if(Oinf[obj][stream_modelid2] == 0) continue;
- if(IsPlayerInRangeOfPoint(player,Oinf[obj][stream_DrawDistance2],Oinf[obj][stream_X2],Oinf[obj][stream_Y2],Oinf[obj][stream_Z2]))
- {
- if(streamer__CreatedForPlayerFlag[player][obj] == 0)
- {
- CreatePlayerObject(player, Oinf[obj][stream_modelid2], Oinf[obj][stream_X2],Oinf[obj][stream_Y2],Oinf[obj][stream_Z2], Oinf[obj][rstream_X2],Oinf[obj][rstream_Y2],Oinf[obj][rstream_Z2], Oinf[obj][stream_DrawDistance2]);
- streamer__CreatedForPlayerFlag[player][obj] = 1;
- }
- }
- else
- {
- if(streamer__CreatedForPlayerFlag[player][obj] == 1)
- {
- DestroyPlayerObject(player, obj);
- streamer__CreatedForPlayerFlag[player][obj] = 0;
- }
- }
- }
- return 1;
- }
- AddObject()
- {
- for(new rands = 0;rands < MAX_DYN_OBJECTS;rands++)
- {
- if(Oinf[rands][stream_modelid2] == 0)
- {
- return rands;
- }
- }
- return INVALID_OBJECT_ID;
- }
- stock DestroyDynObject(objectid)
- {
- Oinf[objectid][stream_modelid2] = 0;
- Oinf[objectid][stream_X2] = -1;
- Oinf[objectid][stream_Y2] = -1;
- Oinf[objectid][stream_Z2] = -1;
- Oinf[objectid][rstream_X2] = -1;
- Oinf[objectid][rstream_Y2] = -1;
- Oinf[objectid][rstream_Z2] = -1;
- Oinf[objectid][stream_DrawDistance2] = -1;
- DynObjects--;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(IsPlayerNPC(playerid))return 1;
- timerupdate[playerid] = SetTimerEx("UpdateObjects", 2000, 1, "i", playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(IsPlayerNPC(playerid)) return 1;
- KillTimer(timerupdate[playerid]);
- for(new obj = 0;obj < MAX_DYN_OBJECTS;obj++)
- {
- if(Oinf[obj][stream_modelid2] == 0) continue;
- if(IsPlayerInRangeOfPoint(playerid,Oinf[obj][stream_DrawDistance2],Oinf[obj][stream_X2],Oinf[obj][stream_Y2],Oinf[obj][stream_Z2]))
- {
- if(streamer__CreatedForPlayerFlag[playerid][obj] == 1)
- {
- DestroyPlayerObject(playerid, obj);
- streamer__CreatedForPlayerFlag[playerid][obj] = 0;
- }
- }
- streamer__CreatedForPlayerFlag[playerid][obj] = 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement