How to detect ammount of players in gang zone
#1

How to detect if there is more than 1 person in a gang zone ?
Reply
#2

Код:
#include <VUF>
Код:
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
Reply
#3

whats vuf ?
Reply
#4

An include, which has a function called: "IsPlayerInPlace". Dont you have? I do o.o
Reply
#5

i dont o.o
Reply
#6

http://pastebin.com/2f9rihNw

I put there
Reply
#7

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);
Reply
#8

any more suggestions ?
Reply
#9

Quote:
Originally Posted by blackwave
Посмотреть сообщение
Код:
#include <VUF>
Код:
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).
Reply
#10

my problem is that whenever 2 ppl from different teams enter a zone , it starts spamming.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)