SA-MP Forums Archive
Fixing something - 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: Fixing something (/showthread.php?tid=107030)



Fixing something - Striker_Moe - 07.11.2009

Hi there

Iґd like to try a filterscript from Pixels out. Unfortunately its not working with SA:MP 0.3. Why?
Код:
public OnPlayerConnect(playerid)
{
	for(new o=0; o<60; o++) CreatePlayerObject(playerid,354,0,0,0,0,0,0);
	Spawned[playerid] = 0;
	return 1;
}

public OnPlayerSpawn(playerid)
{
	Spawned[playerid] = 1;
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	Spawned[playerid] = 0;
	return 1;
}

public SnowTimer()
{
	for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i) && Spawned[i] == 1)
	{
	  SetWorldTime(24);
	 	new Float:Pos[3],Float:pObjectPos[3];
	  GetPlayerPos(i,Pos[0],Pos[1],Pos[2]);
	  for(new b=0; b<60; b++)
	  {
	    if(b < 20) SetPlayerObjectPos(i,b,Pos[0]+random(40)-4,Pos[1],Pos[2]+30);
			if(b < 40 && b > 20) SetPlayerObjectPos(i,b,Pos[0]-random(30)+3,Pos[1],Pos[2]+30);
			if(b < 50 && b > 40) SetPlayerObjectPos(i,b,Pos[0],Pos[1]+random(37)-2,Pos[2]+30);
			if(b > 50) SetPlayerObjectPos(i,b,Pos[0],Pos[1]-random(39)+2,Pos[2]+30);
			GetPlayerObjectPos(i,b,pObjectPos[0],pObjectPos[1],pObjectPos[2]);
	    MovePlayerObject(i,b,pObjectPos[0],pObjectPos[1],Pos[2],5);
	  }
  	}
	return 1;
}



Re: Fixing something - JakeB - 07.11.2009

It hasn't worked since before 0.3.


Re: Fixing something - Backwardsman97 - 07.11.2009

You tell the code to create 60 player objects when the player connects. Well idk why you would want to do that but you're creating them at the player as soon as he connects. So maybe he doesn't have a proper x, y, z?


Re: Fixing something - Striker_Moe - 07.11.2009

Its not my code, Iґve copied it from Pixelґs snow FS. And it worked with SA:MP 0.2 too.


Re: Fixing something - Backwardsman97 - 07.11.2009

Oh, I didn't scroll down. Now I see. Maybe try moving the create objects part and the loop to when the player spawns? You would need to do something to keep it from happening every time though.


Re: Fixing something - Striker_Moe - 07.11.2009

It works now. But another question. Why is this FS not working? (Yes im sure it doesnt work)

http://forum.sa-mp.com/index.php?topic=82530.0