TextDraw Help!
#1

Hey All!
I need a little help again..
I would like to change the gametext to textdraw but i dunno how to make it..
Here is the code:
Код:
public update_zarea() {
new line1[10];
new line2[10];

for(new i=0; i<MAX_PLAYERS_; i++) {
if(IsPlayerConnected(i) && zareaupdates[i] == 1) {
if(IsPlayerInzarea(i,player_zarea[i])) { }
else {

new player_zarea_before;
player_zarea_before = player_zarea[i];
player_zarea[i] = -1;


for(new j=0; j<sizeof(zarea);j++) {
if(IsPlayerInzarea(i,j) && player_zarea[i] == -1) {

if(player_zarea_before == -1) GameTextForPlayer(i,zarea[j][zarea_name],1500,5); //<- Change it to TextDraw
else if(strcmp(zarea[j][zarea_name],zarea[player_zarea_before][zarea_name],true) != 0) GameTextForPlayer(i,zarea[j][zarea_name],1500,5); //<- Change it to TextDraw

player_zarea[i] = j;
format(line1,10,"p%dzarea",i);
format(line2,10,"%d",j);
PropertySet(line1,line2);


}
}



if(player_zarea[i] == -1) player_zarea[i] = player_zarea_before;
}


}
}

}

IsPlayerInzarea(playerid, zareaid) {
if(zareaid == -1) return 0;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid,x,y,z);
if(x >= zarea[zareaid][zarea_minx] && x < zarea[zareaid][zarea_maxx]
&& y >= zarea[zareaid][zarea_miny] && y < zarea[zareaid][zarea_maxy]
&& z >= zarea[zareaid][zarea_minz] && z < zarea[zareaid][zarea_maxz]
&& z < 900.0) return 1;
return 0;
}
public update_zones() {
new line1[10];
new 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) GameTextForPlayer(i,zones[j][zone_name],1500,5); //<- Change it to TextDraw
else if(strcmp(zones[j][zone_name],zones[player_zone_before][zone_name],true) != 0) GameTextForPlayer(i,zones[j][zone_name],1500,5); //<- Change it to TextDraw

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


}
}



if(player_zone[i] == -1) player_zone[i] = player_zone_before;
}


}
}

}

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;
}
(This is c-middia's location script)
I need change the GameTextForPlayer to TextDraw...
Please help me! Thx!
Reply
#2

Help please!
Reply
#3

CreateTextDraw, TextDrawShowForPlayer, TextDrawHideForPlayer etc..
Reply
#4

It's okay but how to do this with textdraw: if(player_zarea_before == -1) GameTextForPlayer(i,zarea[j][zarea_name],1500,5); //<- Change it to TextDraw
?? Please help me!
Reply
#5

First create the textdraw, you can use callback OnGameModeInit() to create it.

Then you can just use TextDrawShowForPlayer(playerid, Text:text) to show the textdraw and TextDrawHideForPlayer(playerid, Text:text) to hide it.

Here's a big thread about textdraws, read this.
Reply
#6

Okay i can create the textdraw but i dunno how to do this:
Text = i,zarea[j][zarea_name]
How can i do this?
Reply
#7

TextDrawSetString(Text:text, string[]);
Reply
#8

Thank you!
Reply
#9

Is it correct?
TextDrawSetString(i,zarea[j][zarea_name])
? (I think it's not...)
Reply
#10

pawn Код:
TextDrawSetString(text draw name, text);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)