[ajuda] Atualizar Text Draw
#1

Opa ae blz galera?
eu fiz peguei um code aki pq faiz tempo que tava tentando fazer e nгo dava
quando entra numa gz aparece la o nome da gz equando sai desaparece

fiz assim
pawn Код:
public GangZonesCheck()
{
    new string[256];
    for(new i = 0; 42 > i; i++)
    {
        if (IsPlayerConnected(i))
        {
            new pZone = GetPlayerZone(i);
            if(pZone != 999)
            {
                format(string,128,"~n~~p~Territ¦rio - %s -", gZonesCoordinates[pZone][gZoneName]);
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
            }
            else if(pZone == 999)
            {
                format(string,256,"~n~~g~Brasil Mata-Mata 2012                 Participe da Nossa comunidade no orkut ~g~http://www.orkut.com.br/Main#Community?cmm=110617106");
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
            }
        }
    }
    return 1;
}
stock GetPlayerZone(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ||GetPlayerInterior(playerid) != 0 || GetPlayerVirtualWorld(playerid) != 0)
        return 999;

    new Float:playerX, Float:playerY, Float:playerZ;
    GetPlayerPos(playerid, playerX, playerY, playerZ);
    new Float:zone_minX, Float:zone_minY, Float:zone_maxX, Float:zone_maxY;
    for (new i=0;i<42;i++)
    {
        zone_minX = gZonesCoordinates[i][ZArea][0];
        zone_minY = gZonesCoordinates[i][ZArea][1];
        zone_maxX = gZonesCoordinates[i][ZArea][2];
        zone_maxY = gZonesCoordinates[i][ZArea][3];
        if (playerX >= zone_minX && playerX <= zone_maxX && playerY >= zone_minY && playerY <= zone_maxY)
        {
            LastZone[playerid] = i;
            return i;
        }
    }
    return 999;
}
settimer da 1 seg

quando entra em uma gz aparece o nome da gz mais quando sai n muda a text draw pra
pawn Код:
format(string,256,"~n~~g~Brasil Mata-Mata 2012                 Participe da Nossa comunidade no orkut ~g~http://www.orkut.com.br/Main#Community?cmm=110617106");
Reply
#2

TextDrawShowForPlayer e TextDrawHideForPlayer
Reply
#3

pawn Код:
public GangZonesCheck()
{
    new string[256];
    for(new i = 0; 42 > i; i++)
    {
        if (IsPlayerConnected(i))
        {
            new pZone = GetPlayerZone(i);
            if(pZone != 999)
            {
                format(string,128,"~n~~p~Territ¦rio - %s -", gZonesCoordinates[pZone][gZoneName]);
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
            }
            else if(pZone == 999)
            {
                TextDrawHideForPlayer(i, ZoneName[i]);
                format(string,256,"~n~~g~Brasil Mata-Mata 2012                 Participe da Nossa comunidade no orkut ~g~http://www.orkut.com.br/Main#Community?cmm=110617106");
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
            }
        }
    }
    return 1;
}
Reply
#4

the falen bela ajuda -.- vc nem leu '-'


carline a text draw continua n mudando
Reply
#5

pawn Код:
public GangZonesCheck()
{
    new string[256];
    for(new i = 0; 42 > i; i++)
    {
        if (IsPlayerConnected(i))
        {
            new pZone = GetPlayerZone(i);
            if(pZone != 999)
            {
                format(string,128,"~n~~p~Territ¦rio - %s -", gZonesCoordinates[pZone][gZoneName]);
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
                print("Carol 1");
            }
            else if(pZone == 999)
            {
                TextDrawHideForPlayer(i, ZoneName[i]);
                format(string,256,"~n~~g~Brasil Mata-Mata 2012                 Participe da Nossa comunidade no orkut ~g~http://www.orkut.com.br/Main#Community?cmm=110617106");
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
                print("Carol 2");
            }
        }
    }
    return 1;
}

bota isto e depois manda oque aparece o nsever.log.
Reply
#6

pawn Код:
else if(pZone == 999)


Para que fazer uma comparaзгo inъtil dessa? Era sу colocar o else direto cara.
Reply
#7

eu j atinha feito de tudo de quand oe jeito -.-
Reply
#8

pequena mudanзa nos cуdigos:
pawn Код:
public GangZonesCheck()
{
    new string[256];
    for(new i = 0; 42 > i; i++)
    {
        if (IsPlayerConnected(i))
        {
            TextDrawHideForPlayer(i, ZoneName[i]);
           
            if(GetPlayerZone(i) == -1)
            {
                format(string,256,"~n~~g~Brasil Mata-Mata 2012                 Participe da Nossa comunidade no orkut ~g~http://www.orkut.com.br/Main#Community?cmm=110617106");
                TextDrawSetString(ZoneName[i], string);
                TextDrawShowForPlayer(i, ZoneName[i]);
                return 1;
            }
           
            format(string,128,"~n~~p~Territ¦rio - %s -", gZonesCoordinates[pZone][gZoneName]);
            TextDrawSetString(ZoneName[i], string);
            TextDrawShowForPlayer(i, ZoneName[i]);
        }
    }
    return 1;
}


stock GetPlayerZone(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ||GetPlayerInterior(playerid) != 0 || GetPlayerVirtualWorld(playerid) != 0)
        return -1;

    for (new i = 0 ; i < 42; i++)
    {
        //if (playerX >= zone_minX && playerX <= zone_maxX && playerY >= zone_minY && playerY <= zone_maxY)
        if(isPlayerGangZone(pid, gZonesCoordinates[i][ZArea][2], gZonesCoordinates[i][ZArea][0], gZonesCoordinates[i][ZArea][3], gZonesCoordinates[i][ZArea][1]))
        {
            LastZone[playerid] = i;
            return LastZone[playerid];
        }
    }
    return -1;
}


isPlayerGangZone(pid, Float: gz_x, Float: gz_y,  Float: gz_x2, Float: gz_y2)
{
        static Float:X, Float:Y, Float:Z;
        GetPlayerPos(pid, X, Y, Z);
        if (X > gz_x && X < gz_x2 && Y > gz_y && Y < gz_y2)
                return true;
        return 0;
}
Reply
#9

nem deu
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)