SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/07/2010, 09:37 PM   #1
shoru93
Big Clucker
 
Join Date: Nov 2009
Posts: 112
Reputation: 0
Default Gang Zone

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" ?
shoru93 is offline  
Old 06/07/2010, 09:46 PM   #2
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: Gang Zone

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;
}
Carlton is offline  
Old 06/07/2010, 09:52 PM   #3
shoru93
Big Clucker
 
Join Date: Nov 2009
Posts: 112
Reputation: 0
Default Re: Gang Zone

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 (c) 1997-2006, ITB CompuPhase


1 Warning.
shoru93 is offline  
Old 06/07/2010, 09:56 PM   #5
shoru93
Big Clucker
 
Join Date: Nov 2009
Posts: 112
Reputation: 0
Default Re: Gang Zone

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
shoru93 is offline  
Old 06/07/2010, 09:57 PM   #6
Antonio [G-RP]
High-roller
 
Join Date: Jul 2009
Location: Canada
Posts: 1,110
Reputation: 4
Default Re: Gang Zone

By telling him to change it to stock, you aren't teaching him WHAT that error means..
Antonio [G-RP] is offline  
Old 06/07/2010, 10:04 PM   #7
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: Gang Zone

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]);
}
Carlton is offline  
Old 06/07/2010, 10:17 PM   #8
shoru93
Big Clucker
 
Join Date: Nov 2009
Posts: 112
Reputation: 0
Default Re: Gang Zone

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 (c) 1997-2006, ITB CompuPhase


2 Errors.
shoru93 is offline  
Old 06/07/2010, 10:19 PM   #9
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: Gang Zone

Quote:
Originally Posted by Antonio [G-RP] View Post
Lmao buddy, you think your helping. You are just confuing the noobs.
I'm not buddys with idiots who post just to increase their post count. I don't have time anymore to spend with you, I already had a problem with you before because your wiseass comments, which you find funny. Just because someone opens a topic in this forum, they are a noob, you opened plenty of topics here, maybe you're just one of them then.
I'm tired with fighting with you, it's like fighting a 10 year old kid, who can't control their anger and decided to rage out on topics, which I've seen you do before.

Quote:
Originally Posted by shoru93 View Post
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 (c) 1997-2006, ITB CompuPhase


2 Errors.
You added CheckZone wrong, because I clearly forwarded it, and post the lines of the error, and warning.
Carlton is offline  
Old 06/07/2010, 10:25 PM   #10
shoru93
Big Clucker
 
Join Date: Nov 2009
Posts: 112
Reputation: 0
Default Re: Gang Zone

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


1 Error.





ZoneScriptData[playerid][1] = SetTimerEx(playerid, "CheckZone", 1000, 1, "i", playerid);
shoru93 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gang zone Lajko1 Scripting Help 3 08/06/2012 06:34 PM
[AJUDA]Gang Zone e Cor Gang angels182 Português/Portuguese 4 16/05/2010 12:56 PM
Gang zone ruckfules99 Help Archive 3 28/04/2010 12:34 PM
Gang zone bluray Help Archive 4 24/01/2010 11:14 AM
Gang zone SnAcH Help Archive 3 03/05/2009 03:53 PM


All times are GMT. The time now is 03:11 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.