#include <a_samp>
new Text:LV, Text:LS, Text:SF, Text:LIN;
public OnFilterScriptInit()
{
LV = TextDrawCreate(318.000000, 430.000000, "~b~Las Venturas");
TextDrawAlignment(LV, 2);
TextDrawBackgroundColor(LV, -16776961);
TextDrawFont(LV, 3);
TextDrawLetterSize(LV, 0.480000, 1.600000);
TextDrawColor(LV, -1);
TextDrawSetOutline(LV, 1);
TextDrawSetProportional(LV, 1);
LIN = TextDrawCreate(318.000000, 430.000000, "~b~San Andreas");
TextDrawAlignment(LIN, 2);
TextDrawBackgroundColor(LIN, -16776961);
TextDrawFont(LIN, 3);
TextDrawLetterSize(LIN, 0.480000, 1.600000);
TextDrawColor(LIN, -1);
TextDrawSetOutline(LIN, 1);
TextDrawSetProportional(LIN, 1);
SF = TextDrawCreate(318.000000, 430.000000, "~b~San Fierro");
TextDrawAlignment(SF, 2);
TextDrawBackgroundColor(SF, -16776961);
TextDrawFont(SF, 3);
TextDrawLetterSize(SF, 0.480000, 1.600000);
TextDrawColor(SF, -1);
TextDrawSetOutline(SF, 1);
TextDrawSetProportional(SF, 1);
LS = TextDrawCreate(318.000000, 430.000000, "~b~Los Santos");
TextDrawAlignment(LS, 2);
TextDrawBackgroundColor(LS, -16776961);
TextDrawFont(LS, 3);
TextDrawLetterSize(LS, 0.480000, 1.600000);
TextDrawColor(LS, -1);
TextDrawSetOutline(LS, 1);
TextDrawSetProportional(LS, 1);
return 1;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(LV);
TextDrawHideForAll(LS);
TextDrawHideForAll(SF);
TextDrawHideForAll(LIN);
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X >= 815 && X <= 3000 && Y >= 717 && Y <= 3000)
{
TextDrawHideForPlayer(playerid, LS);
TextDrawHideForPlayer(playerid, SF);
TextDrawHideForPlayer(playerid, LIN);
TextDrawShowForPlayer(playerid, LV);
}
if(X < 0)
{
TextDrawHideForPlayer(playerid, LS);
TextDrawHideForPlayer(playerid, LV);
TextDrawHideForPlayer(playerid, LIN);
TextDrawShowForPlayer(playerid, SF);
}
if(X > 0 && Y < 0)
{
TextDrawHideForPlayer(playerid, SF);
TextDrawHideForPlayer(playerid, LV);
TextDrawHideForPlayer(playerid, LIN);
TextDrawShowForPlayer(playerid, LS);
}
if(!(X >= 815 && X <= 3000 && Y >= 717 && Y <= 3000) && !(X < 0) && !(X > 0 && Y < 0))
{
TextDrawHideForPlayer(playerid, LV);
TextDrawHideForPlayer(playerid, LS);
TextDrawHideForPlayer(playerid, SF);
TextDrawShowForPlayer(playerid, LIN);
}
return 1;
}
Bem legal mais dica, por que nгo usou TextDrawSetstring invйs de criar 3 Textdraw's ?
Mais ficou legal a funзгo de Getar a cidade. |
Se usasse TextDrawSetString seriam necessarias 1500 textdraws ao invez de 4, haters.
Achei bastante simples, dava pra aprimorar bastante isso ai. |
Se usasse TextDrawSetString seriam necessarias 1500 textdraws ao invez de 4, haters.
Achei bastante simples, dava pra aprimorar bastante isso ai. |
#include <a_samp>
new Text:Local;
public OnFilterScriptInit()
{
Local = TextDrawCreate(318.000000, 430.000000, "_");
TextDrawAlignment(Local, 2);
TextDrawBackgroundColor(Local, -16776961);
TextDrawFont(Local, 3);
TextDrawLetterSize(Local, 0.480000, 1.600000);
TextDrawColor(Local, -1);
TextDrawSetOutline(Local, 1);
TextDrawSetProportional(Local, 1);
return 1;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(Local);
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(X >= 815 && X <= 3000 && Y >= 717 && Y <= 3000)
{
TextDrawHideForPlayer(playerid, Local);
TextDrawSetString(Local, "~b~Las Venturas");
TextDrawShowForPlayer(playerid, Local);
}
if(X < 0)
{
TextDrawHideForPlayer(playerid, Local);
TextDrawSetString(Local, "~b~San Fierro");
TextDrawShowForPlayer(playerid, Local);
}
if(X > 0 && Y < 0)
{
TextDrawHideForPlayer(playerid, Local);
TextDrawSetString(Local, "~b~Los Santos");
TextDrawShowForPlayer(playerid, Local);
}
if(!(X >= 815 && X <= 3000 && Y >= 717 && Y <= 3000) && !(X < 0) && !(X > 0 && Y < 0))
{
TextDrawHideForPlayer(playerid, Local);
TextDrawSetString(Local, "~b~San Andreas");
TextDrawShowForPlayer(playerid, Local);
}
return 1;
}
Se usasse TextDrawSetString seriam necessarias 1500 textdraws ao invez de 4, haters.
Achei bastante simples, dava pra aprimorar bastante isso ai. |
pawn Код:
|
new Text:td[MAX_PLAYERS];
for(new i; i < MAX_PLAYERS; i++) {
td[i] = TextDrawCreate(x, y, "string");
}
TextDrawSetString(td[playerid], "nova string");
pawn Код:
|