Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-07-13, 07:19


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

Chcia?em napisa? funkcj? do konwertowania polskich znak?w w textdrawie tak ?e je?li co? napiszemy np. "?y?ka" to przekonwertuje nam s?owo na "lyzka".
Problem polega na tym, ?e albo nie nic si? nie zmienia a jak zmienie funkcje w cmd na:
Kod:

AddTextDrawTexT(playerid, KonwertujZnaki(msgstr);
to nic si? nie pojawia w textdrawie.



Aktualnie wygl?da to tak:
W cmd:
Kod:

KonwertujZnaki(msgstr);
AddTextDrawTexT(playerid, msgstr);


funkcja do konwertowania
Kod:

stock KonwertujZnaki(text[])
{
for (new i, j= strlen(text); i < j; ++i)
{
if (text[i] == '?') text[i] = 'e';
else if (text[i] == '?') text[i] = 'o';
else if (text[i] == '?') text[i] = 'a';
else if (text[i] == '?') text[i] = 's';
else if (text[i] == '?') text[i] = 'l';
else if (text[i] == '?') text[i] = 'z';
else if (text[i] == '?') text[i] = 'z';
else if (text[i] == '?') text[i] = 'c';
else if (text[i] == '?') text[i] = 'n';
else text[i] = text[i];
text[strlen(text)] = EOS;
}
return text;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-13, 10:05


Combacior







Wiek: 29
Na forum: 5795 dni
Posty: 1516

Piwa: 2161

Respekt: 1060
Respekt: 1060

Ostrzeżeń: 20%
Usu? ten kod

Kod:

else text[i] = text[i];
text[strlen(text)] = EOS;


Ten return te?, tablic w PAWN nie da si? 'zwr?ci?'. Ten kod powinien by? dobry jaki masz

Kod:

KonwertujZnaki(msgstr);
print(msgstr); //daj logi z tego
AddTextDrawTexT(playerid, msgstr);


Jak nie zadzia?a, to zapodaj logi z tej funkcji print i poka? funkcj? AddTextDrawTexT. Tutaj funkcja ze skryptu uDM

Kod:

deletePolish(string[])
{
for(new x, j = strlen(string); x != j; x++)
{
switch(string[x])
{
case '?': string[x] = 'l';
case '?', '?': string[x] = 'z';
case '?': string[x] = 'c';
case '?': string[x] = 'n';
case '?': string[x] = 'e';
case '?': string[x] = 'o';
case '?': string[x] = 'a';
case '?': string[x] = 's';

case '?': string[x] = 'L';
case '?', '?': string[x] = 'Z';
case '?': string[x] = 'C';
case '?': string[x] = 'N';
case '?': string[x] = 'E';
case '?': string[x] = 'O';
case '?': string[x] = 'A';
case '?': string[x] = 'S';
}
}
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-13, 15:15


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

Niestety nie dzia?a a printf w konsoli:
Kod:

KonwertujZnaki(msgstr);
printf(" ›› |LOG| %s",msgstr);
AddTextDrawTexT(playerid, msgstr);

Pokazuje wyraz z polskimi znakami tak jakby w og?le nie dzia?a?a funkcja a gdy zrobie:
Kod:

printf(" ›› |LOG| %s",KonwertujZnaki(msgstr));


to warning 209: function "KonwertujZnaki" should return a value przy kompilacji dlatego tez by? u mnie return text;

Ta co poda?es deletePolish te? pokazuje to samo.

AddTextDrawTexT:





Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-14, 10:56


Combacior







Wiek: 29
Na forum: 5795 dni
Posty: 1516

Piwa: 2161

Respekt: 1060
Respekt: 1060

Ostrzeżeń: 20%
Czy ja da?em kod taki

Kod:

printf(" ›› |LOG| %s",KonwertujZnaki(msgstr));


Czy taki

Kod:

print(msgstr);


Chyba jest r??nica, co? Dziwne, ?e u mnie taki kod dzia?a

Kod:

public OnGameModeInit()
{
new gString[32] = "?y?ka";
deletePolish(gString);
return print(gString);
}

deletePolish(string[])
{
for(new x, j = strlen(string); x != j; x++)
{
switch(string[x])
{
case '?': string[x] = 'l';
case '?', '?': string[x] = 'z';
case '?': string[x] = 'c';
case '?': string[x] = 'n';
case '?': string[x] = 'e';
case '?': string[x] = 'o';
case '?': string[x] = 'a';
case '?': string[x] = 's';

case '?': string[x] = 'L';
case '?', '?': string[x] = 'Z';
case '?': string[x] = 'C';
case '?': string[x] = 'N';
case '?': string[x] = 'E';
case '?': string[x] = 'O';
case '?': string[x] = 'A';
case '?': string[x] = 'S';
}
}
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-14, 12:32


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

Nawet nie pomy?la?em ?e zwr?cisz na to uwag? ale
Kod:

print(msgstr);

i
Kod:

printf("%s",msgstr);

wy?wietlaj? to samo.
Ale ?eby nie by?o to prosz?: Logi za pomoc? print(msgstr);




A tutaj efekt w grze:

Twoja funkcja deletePolish robi to samo.


Tylko teraz zastanawiam si? ?e mo?e to przez to ?e u ciebie element do przekonwertowania wygl?da tak: (znajduje si? w OnGameModeInit
Kod:

public OnGameModeInit()
{
new gString[32] = "?y?ka";
deletePolish(gString);
return print(gString);
}

a u mnie jest to element komendy dla gracza w zcmd:
Kod:

CMD:pm(playerid,cmdtext[])
{
new graczID, msgstr[128];
if(sscanf(cmdtext,"us[128]",graczID, msgstr))
{
SendClientMessage(playerid, COLOR_WHITE, "›› |Info| U?yj /pm [ID] [tekst]");
return 1;
}else if(graczID == INVALID_PLAYER_ID){
SendClientMessage(playerid, COLOR_RED, "›› |Info| Gracz o podanym ID nie jest zalogowany.");
return 1;
}else if(playerid == graczID){
SendClientMessage(playerid, COLOR_RED, "›› |Info| Nie mo?esz pisa? do siebie.");
return 1;
}else{
KonwertujZnaki(msgstr);
print(msgstr);
AddTextDrawTexT(playerid, msgstr);
}
return 1;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-14, 12:48


Combacior







Wiek: 29
Na forum: 5795 dni
Posty: 1516

Piwa: 2161

Respekt: 1060
Respekt: 1060

Ostrzeżeń: 20%
Miejsce nie ma ?adnego znaczenia.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-14, 12:50


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

Wiec w czym mo?e by? problem? Jest tak jakby w og?le tej funkcji tam nie by?o.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 03:21


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

Kod:

#include <a_samp>

public OnFilterScriptInit()
{
new _char[] = "???????棳?񌜏???";
printf("Przed: %s", _char);
deletePolish(_char);
printf("Po: %s", _char);
}

deletePolish(string[])
{
for(new x, j = strlen(string); x != j; x++)
{
new bool:validated = true, switchValue = (j-1!=x) ? (string[x] | string[x + 1] << 8) : (string[x]);
switch(switchValue)
{
case 33988: string[x] = 0x41;
case 34244: string[x] = 0x61;

case 39108, 0x15c: string[x] = 0x45;
case 39364, 0x15d: string[x] = 0x65;

case 37827: string[x] = 0x4f;
case 46019, 0x176: string[x] = 0x6f;

case 34500: string[x] = 0x43;
case 34756: string[x] = 0x63;

case 33221: string[x] = 0x4c;
case 33477: string[x] = 0x6c;

case 33733: string[x] = 0x4e;
case 33989: string[x] = 0x6e;

case 39621: string[x] = 0x53;
case 39877: string[x] = 0x73;

case 47557, 48069: string[x] = 0x5a;
case 47813, 48325: string[x] = 0x7a;

default: { validated = false; }
}

if(validated)
{
j-=1;
for(new g=x;g!=j;g++)
string[g + 1] = string[g + 2];
string[j] = 0x0;
}
}
}




Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 07:28


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

Nie dzia?a
Kod:

CMD:test(playerid, params[])
{
//fck(playerid);
new _char[] = "???????棳?񌜏???";
printf("Przed: %s", _char);
deletePolish(_char);
printf("Po: %s", _char);
return 1;
}


Kod:

[07:26] [connection] incoming connection: 127.0.0.1:56601 id: 1
[07:26] [join] InTeRn has joined the server (1:127.0.0.1)
[07:27] Przed: ?? ?????棳?񌜏???
[07:27] Po: ?? ?????棳?񌜏???
[07:27] *** Audio Plugin: InTeRn (ID: 1) has connected


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 11:25


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

Zamie? funkcj? na t? kt?r? podes?a?em, geniuszu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 12:55


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

"IgrexolonO" napisał/a:

Zamie? funkcj? na t? kt?r? podes?a?em, geniuszu.


A? tak t?py nie jestem :D , zmieni?em. Mo?e to nie jest wina funkcji nie wiem o co chodzi ani jak to naprawi? heh :<


Dobra Ju? chyba wiem tylko nadal nie wiem czym to jest spowodowane, zrobi?em to w osobnym pliku w filterscripts i zadzia?a?o co? nie tak jest z gm'em.

Ostatnio zmieniony przez misjane 2016-07-15, 13:06, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 13:05


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

Kod:

#include <a_samp>

public OnFilterScriptInit()
{
new _char[] = "???????棳?񌜏???";
deletePolish(_char);
}

deletePolish(string[])
{
for(new x, j = strlen(string); x != j; x+=2)
{
new switchValue = (j-1!=x) ? (string[x] | string[x + 1] << 8) : (string[x]);
printf("Index: %d, Val: %d", x, switchValue);
}
}


Wrzu? ten skrypt i poka? screena co zwr?ci konsola.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 13:11


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50

Doda?em to w filterscript i w gamemod, efekt:


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 13:15


IgrexolonO







Wiek: 34
Na forum: 6809 dni
Posty: 1386

Piwa: 1062

Respekt: 651,8
Respekt: 651,8Respekt: 651,8

W takim razie jeszcze to wrzu? do gamemode'a:

Kod:

#include <a_samp>

public OnFilterScriptInit()
{
new _char[] = "???????棳?񌜏???";
deletePolish(_char);
}

deletePolish(string[])
{
for(new x, j = strlen(string); x != j; x++)
{
printf("Index: %d, Val Single: %d, Val Double: %d", x, string[x], (j-1!=x) ? (string[x] | string[x + 1] << 8) : (string[x]));
}
}


I poka? co zwr?ci.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-15, 13:19


misjane







Wiek: 29
Na forum: 5127 dni
Posty: 46



Respekt: 50



Postaw piwo autorowi tego posta
 

 
Tagi: zmiana :: polskich :: znaków
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » Zmiana polskich znaków Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku