SA-MP Forums Archive
Problem with streamer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with streamer (/showthread.php?tid=131926)



Problem with streamer - adytzu32 - 05.03.2010

hi,i have this code:
Код:
#include <a_samp>
#define FILTERSCRIPT
#define MAX_STREAMED_OBJECTS 5000 
new ObjectModel[MAX_STREAMED_OBJECTS]; 
new Float:ObjectPos[MAX_STREAMED_OBJECTS][3]; 
new Float:ObjectRotation[MAX_STREAMED_OBJECTS][3]; 
new Float:ObjectDistance[MAX_STREAMED_OBJECTS]; 
new ObjectIDS[MAX_PLAYERS][MAX_STREAMED_OBJECTS]; 
new ObjectStreamed[MAX_PLAYERS][MAX_STREAMED_OBJECTS]; 
new ObjectID = -1; 
new ObjectUsed[MAX_STREAMED_OBJECTS]; 
SetTimer("Stream", 400, true);
stock CreateObjectEx(ModelID, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:Dist = 100.0)
{
	ObjectID++; //id obiect
	ObjectModel[ObjectID] = ModelID; 
	ObjectPos[ObjectID][0] = X; 
	ObjectPos[ObjectID][1] = Y; 
	ObjectPos[ObjectID][2] = Z; 
	ObjectRotation[ObjectID][0] = rX; 
	ObjectRotation[ObjectID][1] = rY;
	ObjectRotation[ObjectID][2] = rZ; 
	ObjectDistance[ObjectID] = Dist; 
	ObjectUsed[ObjectID] = 1; 
}
forward Stream();
public Stream()
{
	for(new i; i<MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i)) 
	  {
	    for(new S; S<ObjectID+1; S++) 
	    {
	      if(ObjectUsed[S] == 1) 
	      {
					if(IsPlayerInRangeOfPoint(i, ObjectDistance[S], ObjectPos[S][0], ObjectPos[S][1], ObjectPos[S][2]) && ObjectStreamed[i][S] == 0)
					{
					  ObjectIDS[i][S] = CreatePlayerObject(i, ObjectModel[S], ObjectPos[S][0], ObjectPos[S][1], ObjectPos[S][2], ObjectRotation[S][0], ObjectRotation[S][1], ObjectRotation[S][2]);//Create the object
	          ObjectStreamed[i][S] = 1; 
	          continue;
					}
				}
				if(!IsPlayerInRangeOfPoint(i, ObjectDistance[S], ObjectPos[S][0], ObjectPos[S][1], ObjectPos[S][2]) && ObjectStreamed[i][S] == 1) 
				{
  				ObjectStreamed[i][S] = 0;
				  DestroyPlayerObject(i, ObjectIDS[i][S]);
				  continue;
				}
			}
		}
	}
	return 1;
}
stock DestroyObjectEx(ObjectId)
{
	ObjectUsed[ObjectId] = 0;
	for(new i; i<MAX_PLAYERS; i++)
	{
	  if(ObjectStreamed[i][ObjectId] == 1)
	  {
	  	ObjectStreamed[i][ObjectId] = 0;
	  	DestroyPlayerObject(i, ObjectIDS[i][ObjectId]);
		}
	}
}


stock SetObjectDistance(ObjectId, Float:Dist) 
{
	ObjectDistance[ObjectId] = Dist;
}
and my error is
Код:
D:Documents and SettingsadyDesktopGTARPfilterscripts222.pwn(12) : error 021: symbol already defined: "SetTimer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
some help?


Re: Problem with streamer - Torran - 05.03.2010

Put SetTimer inside a callback and not outside


Re: Problem with streamer - ¤Adas¤ - 05.03.2010

SetTimer must be under callback, for example OnFilterScriptInit().

EDIT: LMAO, Torran, why are you allways faster than me?


Re: Problem with streamer - adytzu32 - 05.03.2010

ohh yeah i forget about it thanks alot