SA-MP Forums Archive
Map name with textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Map name with textdraw (/showthread.php?tid=601594)



Map name with textdraw - N0FeaR - 23.02.2016

Have some problem try to make textdraw that show location, but the problem is for ex if i am at ganton says i am Idlewood and if i stand still its just showing some random names. i hope u guys can help me out.

PHP код:
    Mapdraw = TextDrawCreate(48.000000, 326.000000, "");
    
TextDrawBackgroundColor(Mapdraw, 255);
    
TextDrawFont(Mapdraw, 1);
    
TextDrawLetterSize(Mapdraw, 0.500000, 1.200000);
    
TextDrawColor(Mapdraw, -1);
    
TextDrawSetOutline(Mapdraw, 0);
    
TextDrawSetProportional(Mapdraw, 1);
    
TextDrawSetShadow(Mapdraw, 1);
    
TextDrawSetSelectable(Mapdraw, 0);
stock GetPlayerArea(playerid)
{
    new 
str[128];
    
format(str,sizeof(str),"%s",Zones[GetPlayerZone(playerid)][zone_name]);
    if(
GetPlayerInterior(playerid) > 0)
    {
        if(
GetPVarInt(playerid, "GarageEnter") != 1000 && GetPlayerInterior(playerid) == GarageInfo[GetPVarInt(playerid, "GarageEnter")][gInterior])
        {
            
format(str,sizeof(str),"%s", GarageInfo[GetPVarInt(playerid, "GarageEnter")][gName]);
        }
        else if(
GetPVarInt(playerid, "HouseEnter") != 1000 && GetPlayerInterior(playerid) == HouseInfo[GetPVarInt(playerid, "HouseEnter")][hInterior])
        {
            
format(str,sizeof(str),"%s", HouseInfo[GetPVarInt(playerid, "HouseEnter")][hName]);
        }
        else if(
GetPVarInt(playerid, "IntEnter") != 1000 && GetPlayerInterior(playerid) == IntInfo[GetPVarInt(playerid, "IntEnter")][iInt])
        {
            
format(str,sizeof(str),"%s", IntInfo[GetPVarInt(playerid, "IntEnter")][iName]);
        }
        else if(
GetPVarInt(playerid, "BizzEnter") != 1000 && GetPlayerInterior(playerid) == BizzInfo[GetPVarInt(playerid, "BizzEnter")][bInterior])
        {
            
format(str,sizeof(str),"%s", BizzInfo[GetPVarInt(playerid, "BizzEnter")][bName]);
        }
        else 
str="Interior";
    }
    return 
str;
}
stock GetPlayerZone(playerid)
{
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    for(new 
i=0;i<sizeof(Zones);i++)
    {
        if(
x > Zones[i][zone_minx] && y > Zones[i][zone_miny] && z > Zones[i][zone_minz] && x < Zones[i][zone_maxx] && y < Zones[i][zone_maxy] && z < Zones[i][zone_maxz])
        return 
i;
    }
    return 
false;
}
//============================================//
stock LoadAreaPl(playerid, type, num)
{
    new 
string[128];
    switch(
type)
    {
        case 
0: format(string, 128, "%s", GetPlayerArea(playerid));
        case 
1: format(string, 128, "%s", HouseInfo[num][hName]);
        case 
2: format(string, 128, "%s", IntInfo[num][iName]);
        case 
3: format(string, 128, "%s", BizzInfo[num][bName]);
        case 
4: format(string, 128, "%s", GarageInfo[num][gName]);
        case 
5: string="Interior";
    }
    if(
GetPVarInt(playerid,"HudHide") == 0) TextDrawSetString(Text:Mapdraw, string);
    
//if(GetPVarInt(playerid,"HudHide") == 0) GameTextForPlayer(playerid, string, 2000, 1);
    
return true;
}