I have no idea how to solve this! :(
#10

pawn Код:
forward update_zones();
public update_zones() {
    new
        line1[10],
        line2[10];

    for(new i=0; i<MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) && zoneupdates[i] == 1) {
            if(IsPlayerInZone(i,player_zone[i])) {
            }
            else {
                new
                    player_zone_before;

                player_zone_before = player_zone[i];
                player_zone[i] = -1;

                for(new j=0; j<sizeof(zones);j++) {
                    if(IsPlayerInZone(i,j) && player_zone[i] == -1) {
                        if(player_zone_before == -1)
                        {
                            CreateTDZ(i, zones[j][zone_name]);
                        }
                        else if(strcmp(zones[j][zone_name],zones[player_zone_before][zone_name],true) != 0)
                        {
                            CreateTDZ(i, zones[j][zone_name]);
                        }

                        player_zone[i] = j;
                        format(line1,10,"p%dzone",i);
                        format(line2,10,"%d",j);

                    }
                }
                if(player_zone[i] == -1) player_zone[i] = player_zone_before;
            }
        }
    }
}
forward HidePlayerTextDraw(i);
public HidePlayerTextDraw(i)
{
    PlayerTextDrawHide(i, Textdraw0);
    PlayerTextDrawDestroy(i, Textdraw0);
    return 1;
}
CreateTDZ(i, z)
{
    new str[50];
    format(str, 50, "%s", z);
    Textdraw0 = CreatePlayerTextDraw(i,500.000000, 350.000000, str);
    PlayerTextDrawAlignment(i,Textdraw0, 3);
    PlayerTextDrawBackgroundColor(i,Textdraw0, 255);
    PlayerTextDrawFont(i,Textdraw0, 0);
    PlayerTextDrawLetterSize(i,Textdraw0, 0.879999, 2.499999);
    PlayerTextDrawColor(i,Textdraw0, -1);
    PlayerTextDrawSetOutline(i,Textdraw0, 0);
    PlayerTextDrawSetProportional(i,Textdraw0, 1);
    PlayerTextDrawSetShadow(i,Textdraw0, 1);
    PlayerTextDrawSetSelectable(i,Textdraw0, 0);
    PlayerTextDrawShow(i, Textdraw0);
    SetTimerEx("HidePlayerTextDraw", 1500, 0, "i", i);
}
IsPlayerInZone(playerid, zoneid) {
    if(zoneid == -1) return 0;

    new
        Float:x,
        Float:y,
        Float:z;

    GetPlayerPos(playerid,x,y,z);

    if(x >= zones[zoneid][zone_minx] && x < zones[zoneid][zone_maxx]
    && y >= zones[zoneid][zone_miny] && y < zones[zoneid][zone_maxy]
    && z >= zones[zoneid][zone_minz] && z < zones[zoneid][zone_maxz]
    && z < 900.0) return 1;

    return 0;
}
Here you go.
Reply


Messages In This Thread
I have no idea how to solve this! :( - by JEkvall95 - 29.11.2012, 21:06
Re: I have no idea how to solve this! :( - by [D]ry[D]esert - 29.11.2012, 21:53
Re: I have no idea how to solve this! :( - by ViniBorn - 29.11.2012, 22:02
Re: I have no idea how to solve this! :( - by JEkvall95 - 29.11.2012, 22:06
Re: I have no idea how to solve this! :( - by kaisersouse - 29.11.2012, 22:07
Re: I have no idea how to solve this! :( - by JEkvall95 - 30.11.2012, 16:54
Re: I have no idea how to solve this! :( - by JEkvall95 - 01.12.2012, 12:39
Re: I have no idea how to solve this! :( - by maramizo - 01.12.2012, 14:41
Re: I have no idea how to solve this! :( - by JEkvall95 - 02.12.2012, 08:28
Re: I have no idea how to solve this! :( - by maramizo - 02.12.2012, 11:45

Forum Jump:


Users browsing this thread: 2 Guest(s)