Duda/Ayuda TextDraw,TextDrawSetString,barra... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (
https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Duda/Ayuda TextDraw,TextDrawSetString,barra... (
/showthread.php?tid=468931)
Duda/Ayuda TextDraw,TextDrawSetString,barra... -
OTACON - 11.10.2013
Buenas a todos, esto es simple... como poguia hacer l osiguiente en una sola linea para no poner tantosTextDrawSetString, seria ocn porcentajes pero estoy medio dudoso como realizarlo bien.
Desde ya muchas Gracias.
pawn Код:
new opcion;
opcion++;
switch(opcion) {
case 1: TextDrawSetString(Text:TEXTDRAWID,"~g~I~y~IIIIIIIII");
case 2: TextDrawSetString(Text:TEXTDRAWID,"~g~II~y~IIIIIIII");
case 3: TextDrawSetString(Text:TEXTDRAWID,"~g~III~y~IIIIIII");
case 4: TextDrawSetString(Text:TEXTDRAWID,"~g~IIII~y~IIIIII");
case 5: TextDrawSetString(Text:TEXTDRAWID,"~g~IIIII~y~IIIII");
case 6: TextDrawSetString(Text:TEXTDRAWID,"~g~IIIIII~y~IIII");
case 7: TextDrawSetString(Text:TEXTDRAWID,"~g~IIIIIII~y~III");
case 8: TextDrawSetString(Text:TEXTDRAWID,"~g~IIIIIIII~y~II");
case 9: TextDrawSetString(Text:TEXTDRAWID,"~g~IIIIIIIII~y~I");
case 10: TextDrawSetString(Text:TEXTDRAWID,"~y~IIIIIIIIII");
}
Respuesta: Duda/Ayuda TextDraw,TextDrawSetString,barra... -
DesingMyCry - 11.10.2013
Hacerlo en una linea es imposible, al menos imposible sin deformar el script.
pawn Код:
#define opcion 3
new bucle;
new temp[18] = "~g~", slot = 3;
while(bucle < 10)
{
if(bucle == opcion)
{
strcat(temp, "I~y~");
slots += 4;
}
else
{
bucle[slot++] = 'I';
}
bucle++;
}
Esa es una forma. Si bien, tienen practicamente la misma cantidad de lineas, tiene la ventaja de que si en el caso de usar switch, para aumentar la opciуn (ejemplo, a 100) abria que colocar 100 lineas mas, con el cуdigo que te deje solamente abria que cambiar el 10 por 100 y aumentar el tamaсo proporcional de la variable "temp" ( teniendo en cuenta que ahora es 18 y si abrian 100 opciones mas, serian 118 ).