SA-MP Forums Archive
countdown but not for all - 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: countdown but not for all (/showthread.php?tid=105303)



countdown but not for all - a-day - 28.10.2009

hi everybody i searched for a countdown who works only for the player who are in my near so that other players who are at on a other pleace cant see him
for example i and 6 other players are on the golgengate and i start a countcown only they who are in my near can see them
the other who are at an other point like the chip wich is under the golden gate cant se them
can somebody help me ?


Re: countdown but not for all - Tigerbeast11 - 28.10.2009

I think you would need PlayerToPoint, maybe?

Get the position of the player starting the countdown and do PlayerToPoint 6, or something


Re: countdown but not for all - dice7 - 28.10.2009

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: countdown but not for all - a-day - 28.10.2009

a friend has made me this code but it dosnt work so how it needs :/ i dosnt understand it

Код:
#include <a_samp>
forward Count(playerid);
new counter[MAX_PLAYERS];
new cnt[MAX_PLAYERS];
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}



public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/count", cmdtext, true, 10) == 0)
	{

	cnt[playerid] = SetTimerEx("Count",1000,1,"i",playerid);
	return 1;
	}
	return 0;
}
forward PlayerToPoint(Float:radi, playerid, Float:xs, Float:ys, Float:zs);
public PlayerToPoint(Float:radi, playerid, Float:xs, Float:ys, Float:zs)
{
  if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -xs);
		tempposy = (oldposy -ys);
		tempposz = (oldposz -zs);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
stock GameTextForNearPlayers(playerid,Text[],time,Style)
{
new Float:pos[3];
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
for(new i = 0;i<MAX_PLAYERS;i++){
if(IsPlayerConnected(i)){
if(PlayerToPoint(4.0,playerid,pos[0],pos[1],pos[2]))GameTextForPlayer(i,Text,time,Style);}}
return 1;
}
public Count(playerid)
{
switch(counter[playerid])
{
case 0:GameTextForNearPlayers(playerid,"~w~0",1000, 3);
case 1:GameTextForNearPlayers(playerid,"~w~1",1000, 3);
case 2:GameTextForNearPlayers(playerid,"~w~2",1000, 3);
case 3:GameTextForNearPlayers(playerid,"~w~3",1000, 3);
case 4:GameTextForNearPlayers(playerid,"~w~4",1000, 3);
case 5:{GameTextForNearPlayers(playerid,"~w~5",1000, 3);counter[playerid]= 0;KillTimer(cnt[playerid]);}
}
counter[playerid]++;
return 1;
}



Re: countdown but not for all - Tigerbeast11 - 28.10.2009

LOL, dont understand it!!!!! XD


Re: countdown but not for all - MadeMan - 28.10.2009

pawn Код:
if (strcmp("/count", cmdtext, true, 10) == 0)
Change it to

pawn Код:
if (strcmp("/count", cmdtext, true) == 0)
and also under GameTextForNearPlayers

pawn Код:
if(PlayerToPoint(4.0,i,pos[0],pos[1],pos[2]))GameTextForPlayer(i,Text,time,Style);}}
playerid to i