SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 07/08/2020, 03:42 PM   #1
HusteD
Huge Clucker
 
Join Date: Oct 2017
Posts: 204
Reputation: 0
Default Área gz

Opa quero saber como faço pra detectar se o player está na gz e se ele entrar enviar uma mensagem, e deixar uma textdraw rolando, e ao player morrer ele retornar a um local que eu irei definir
HusteD is offline   Reply With Quote
Old 08/08/2020, 11:39 PM   #2
HusteD
Huge Clucker
 
Join Date: Oct 2017
Posts: 204
Reputation: 0
Default Re: Área gz

upup
HusteD is offline   Reply With Quote
Old 09/08/2020, 02:28 AM   #3
Nyft
Big Clucker
 
Nyft's Avatar
 
Join Date: Dec 2019
Posts: 192
Reputation: 11
Thumbs up Re: Área gz

Use o streamer..

Code:
Functions:

native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native IsPlayerInDynamicArea(playerid, areaid)
native IsValidDynamicArea(areaid)

Callbacks:

 OnPlayerEnterDynamicArea(playerid, areaid)
 OnPlayerLeaveDynamicArea(playerid, areaid)
ou

Chame um timer para verificar quando o player entrou/saiu da GangZone

PHP Code:
#define function%0(%1) \
    
forward%0(%1); public%0(%1)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //

public OnGameModeInit()
{
    
MyZone CreateGangZone(Float:MinXFloat:MinYFloat:MaxXFloat:MaxY);
    return 
1;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //

new timerEnterGZ[MAX_PLAYERS];

timerEnterGZ[playerid] = SetTimerEx("UpdatePlayerGangZone"1000true"i"playerid)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //

function UpdatePlayerGangZone(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
IsPlayerInGangZone(playeridMyZone))
        {
            
GameTextForPlayer(playerid"~w~ENTROU NA GANGZONE"10003);
        }
        
KillTimer(timerEnterGZ[playerid]);
    }
    return 
1;

Eu ainda sim acho que esse timer para cada player está errado...
__________________
Nyft#0222
Nyft is online now   Reply With Quote
Old 09/08/2020, 03:18 AM   #4
1sbedx
Huge Clucker
 
Join Date: Dec 2015
Posts: 366
Reputation: 50
Default Re: Área gz

.inc
pawn Code:
new GangZoneArea[MAX_GANG_ZONES] = { INVALID_STREAMER_ID, ... };

forward OnPlayerEnterGangZone(playerid, id);
forward OnPlayerLeaveGangZone(playerid, id);

stock GZ_GangZoneCreate(Float: minx, Float: miny, Float: maxx, Float: maxy) {
  new id = INVALID_GANG_ZONE;

  if ((id = GangZoneCreate(minx, miny, maxx, maxy)) == INVALID_GANG_ZONE) {
    return INVALID_GANG_ZONE;
  }

  GangZoneArea[id] = CreateDynamicRectangle(minx, miny, maxx, maxy);
  return id;
}

#if defined _ALS_GangZoneCreate
  #undef GangZoneCreate
#else
  #define _ALS_GangZoneCreate
#endif

#define GangZoneCreate GZ_GangZoneCreate

stock GZ_GangZoneDestroy(id) {
  if (!GangZoneDestroy(id)) {
    return 0;
  }

  if (IsValidDynamicArea(GangZoneArea[id])) {
    DestroyDynamicArea(GangZoneArea[id]);

    GangZoneArea[id] = INVALID_STREAMER_ID;
  }
  return 1;
}

#if defined _ALS_GangZoneDestroy
  #undef GangZoneDestroy
#else
  #define _ALS_GangZoneDestroy
#endif

#define GangZoneDestroy GZ_GangZoneDestroy

public OnPlayerEnterDynamicArea(playerid, areaid) {
  for (new i; i < MAX_GANG_ZONES; i++) {
    if (areaid == GangZoneArea[i]) {
      CallLocalFunction(!"OnPlayerEnterGangZone", !"dd", playerid, i);
      break;
    }
  }
  #if defined GZ_OnPlayerEnterDynamicArea
    return GZ_OnPlayerEnterDynamicArea(playerid, areaid);
  #else
    return 1;
  #endif
}
#if defined _ALS_OnPlayerEnterDynamicArea
  #undef OnPlayerEnterDynamicArea
#else
  #define _ALS_OnPlayerEnterDynamicArea
#endif

#define OnPlayerEnterDynamicArea GZ_OnPlayerEnterDynamicArea
#if defined GZ_OnPlayerEnterDynamicArea
  forward GZ_OnPlayerEnterDynamicArea(playerid, areaid);
#endif

public OnPlayerLeaveDynamicArea(playerid, areaid) {
  for (new i; i < MAX_GANG_ZONES; i++) {
    if (areaid == GangZoneArea[i]) {
      CallLocalFunction(!"OnPlayerLeaveGangZone", !"dd", playerid, i);
      break;
    }
  }
  #if defined GZ_OnPlayerLeaveDynamicArea
    return GZ_OnPlayerLeaveDynamicArea(playerid, areaid);
  #else
    return 1;
  #endif
}
#if defined _ALS_OnPlayerLeaveDynamicArea
  #undef OnPlayerLeaveDynamicArea
#else
  #define _ALS_OnPlayerLeaveDynamicArea
#endif

#define OnPlayerLeaveDynamicArea GZ_OnPlayerLeaveDynamicArea
#if defined GZ_OnPlayerLeaveDynamicArea
  forward GZ_OnPlayerLeaveDynamicArea(playerid, areaid);
#endif
...
pawn Code:
public OnPlayerEnterGangZone(playerid, id) {
}

public OnPlayerLeaveGangZone(playerid, id) {
}
1sbedx is offline   Reply With Quote
Old 09/08/2020, 03:22 AM   #5
HusteD
Huge Clucker
 
Join Date: Oct 2017
Posts: 204
Reputation: 0
Default Re: Área gz

tipo quero saber como vou fazer pra reconhecer a área da minha gang zone
HusteD is offline   Reply With Quote
Old 09/08/2020, 03:33 AM   #6
Nyft
Big Clucker
 
Nyft's Avatar
 
Join Date: Dec 2019
Posts: 192
Reputation: 11
Default Re: Área gz

Só usar agora...

PHP Code:
new MyZone;

public 
OnGameModeInit()
{
    
MyZone CreateGangZone(...);
    return 
1;
}

public 
OnPlayerEnterGangZone(playeridid
{
    if(
id == MyZone)
    {
        
// ...
    
}
    return 
1;

__________________
Nyft#0222
Nyft is online now   Reply With Quote
Reply

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
[FilterScript] Secure Area (If you leave the AREA, you lose LIFE) Ver. 2.0 Cromartie Filterscripts 9 13/04/2019 12:33 PM
[Map] My first map [party area and on the roof fighting area] pagalcena Maps 3 08/03/2013 11:06 AM
player in area.. but not a square area check.?.? Outbreak Help Archive 6 10/02/2009 09:24 AM


All times are GMT. The time now is 02:29 AM.


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