Gang Zone
#1

So lets say that I already have a gang zone definied, it shows the zone on map and runs perfect.
But how to make, when I enter in that zone to say" Youre entered in zone" ?
Reply
#2

Use the IsPlayerInArea function which is below. ( I sorta edited it for you )

pawn Code:
public IsPlayerInArea(playerid, Float:maxx, Float:maxy, Float:minx, Float:miny)
{
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   if(x < maxx && y < maxy  && x > minx && y > miny) return 1;
   return 0;
}
Reply
#3

D:\Games\GRANDT~1\GTASHOT\GAMEMO~1\gtashot.pwn(295 ) : warning 235: public function lacks forward declaration (symbol "IsPlayerInArea")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

Change 'public' to 'stock'
Reply
#5

and if there are many gang zones, for example if i enter in red zone say youve entered in red zone and if green, you ve entered green
Reply
#6

By telling him to change it to stock, you aren't teaching him WHAT that error means..
Reply
#7

Quote:
Originally Posted by Antonio [G-RP]
View Post
By telling him to change it to stock, you aren't teaching him WHAT that error means..
Jeez, you came back, the forum was better without your useless posts, just to increase your post count. But whatever, i'm not here posting to watch your idiotic comments.

Anyway, back to the topic. All you need to do is set a timer and check if the player is in the area, here is a snippet.

pawn Code:
new ZoneScriptData[MAX_PLAYERS][2];

public OnPlayerConnect(playerid) {
    ZoneScriptData[playerid][0] = -1;
    ZoneScriptData[playerid][1] = SetTimerEx(playerid, "CheckZone", 1000, 1, "i", playerid);
    return 1;
}

forward CheckZone(playerid);
public CheckZone(playerid) {
    if(IsPlayerInArea(MyGangZoneCoordinates)) // Red zone.
    {
         GameTextForPlayer(playerid, "You're in the red zone", 3000, 5);
         ZoneScriptData[playerid][0] = 1; // Redzone.
    }
    else if(IsPlayerInArea(MyGangZoneCoordinates)) // Red zone.
    {
         GameTextForPlayer(playerid, "You're in the green zone", 3000, 5);
         ZoneScriptData[playerid][0] = 2; // Greenzone.
    }
}

public OnPlayerDisconnect(playerid) {
    KillTimer(ZoneScriptData[playerid][1]);
}
Reply
#8

D:\Games\GRANDT~1\GTASHOT\GAMEMO~1\gtashot.pwn(251 ) : error 035: argument type mismatch (argument 1)
D:\Games\GRANDT~1\GTASHOT\GAMEMO~1\gtashot.pwn(542 ) : error 010: invalid function or declaration
D:\Games\GRANDT~1\GTASHOT\GAMEMO~1\gtashot.pwn(543 ) : warning 235: public function lacks forward declaration (symbol "CheckZone")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#9

D:\Games\GRANDT~1\GTASHOT\GAMEMO~1\gtashot.pwn(251 ) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.





ZoneScriptData[playerid][1] = SetTimerEx(playerid, "CheckZone", 1000, 1, "i", playerid);
Reply
#10

Quote:
Originally Posted by shoru93
View Post
D:\Games\GRANDT~1\GTASHOT\GAMEMO~1\gtashot.pwn(251 ) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Post the line of the error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)