How to detect ammount of players in gang zone - 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: How to detect ammount of players in gang zone (
/showthread.php?tid=194439)
How to detect ammount of players in gang zone -
Saurik - 29.11.2010
How to detect if there is more than 1 person in a gang zone ?
Re: How to detect ammount of players in gang zone -
blackwave - 29.11.2010
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInPlace(playerid, Float:X_min, Float:X_max, Float:y_min, Float:y_max, Float:z_max, Float:z_min))
count++;
return 1;
}
I dont know if works
Re: How to detect ammount of players in gang zone -
Saurik - 29.11.2010
whats vuf ?
Re: How to detect ammount of players in gang zone -
blackwave - 29.11.2010
An include, which has a function called: "IsPlayerInPlace". Dont you have? I do o.o
Re: How to detect ammount of players in gang zone -
Saurik - 29.11.2010
i dont o.o
Re: How to detect ammount of players in gang zone -
blackwave - 29.11.2010
http://pastebin.com/2f9rihNw
I put there
Re: How to detect ammount of players in gang zone -
Rachael - 29.11.2010
you could also use Incognito's streamer
http://forum.sa-mp.com/showthread.ph...gnito+streamer
pawn Код:
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native IsPlayerInDynamicArea(playerid, areaid);
Re: How to detect ammount of players in gang zone -
Saurik - 29.11.2010
any more suggestions ?
Re: How to detect ammount of players in gang zone -
iggy1 - 29.11.2010
Quote:
Originally Posted by blackwave
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInPlace(playerid, Float:X_min, Float:X_max, Float:y_min, Float:y_max, Float:z_max, Float:z_min))
count++;
return 1;
}
I dont know if works
|
4 Mistakes there:
1, You use "playerid" when it should be "i".
2, No semicolon after the isplayerinplace statement.
3, no closing brace on the loop.
4, Related to 3 the loop will do one itteration and hit return 1.
As said ealier use incognitos streamer then loop through players to see who is in the same area, and if they are on the same team. I guess you could also do a count when a player enters and leaves an area would save looping i guess. But little more complicated. Also there is an IsPlayerInArea function that you will find with a search (i'd link but i don't have the link).
Re: How to detect ammount of players in gang zone -
Saurik - 29.11.2010
my problem is that whenever 2 ppl from different teams enter a zone , it starts spamming.