Jump to content

[F]Lekce 3. - Zavorky


ffredyk

Recommended Posts

  • Majitel

<p>Nekteri si mysleji, ze psat vsechno krkolome a ruzne michat zavorky nema zadny vyznam.. Naopak.. Kdyz si script radkujete a "tabujete" tak se v tom lepsi pawneri (treba ja) lepe vyznaji.. Napr. kdyz mi nekdo predhodi script kterej je splacanej na 5 radcich a ani to neni tabovany tak ho poslu do ... Nikomu se nechce lustit kde co je a tak by se nemelo psat treba takhle:

new string[20];
GetPlayerName(playerid,string,sizeof(string));
new string2[80];
format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

 

V tomto by se jeste kazdy vyznal.. Ale kdyz ptom mate slozitejsi funkce a mate to na 20 radcich.. Hledat ty promenne a funkce se nikomu fakt nechce..

 

Ukazka jak bych to zapsal ja:

new string[20];
new string2[80];

GetPlayerName(playerid,string,sizeof(string));

format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

 

Na kompilator to nema efekt a reknete sami.. Nevypada to lip?

 

Navic tabovani vyuzijete hlavne pri psani nekolika "zavorkovych" funkci do sebe.. Napriklad uvedu smycku, ktera kontroluje zda-li je hrac ve smycce pripojen a zda-li ma promennou [promenna] nastavenou na 1..


for(new i;i

Link to comment
Share on other sites

Tim chtel ffredyk rict at nedelate tohle: :d

for(new i;iif(IsPlayerConnected(i)){
if(promenna[i] == true){
SendClientMessage(playerid,B_ZLUTA,"Mas nastavenou promennou");
}}}

Link to comment
Share on other sites

  • 3 months later...

good tut ale nevyzerá to dobre... podla mna... je to také nepriehladné :d

toto:

new string[20];

new string2[80];

 

GetPlayerName(playerid,string,sizeof(string));

 

format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

toto je krajšie

 

new string[20];

GetPlayerName(playerid,string,sizeof(string));

new string2[80];

format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

Link to comment
Share on other sites

Pls kde ktomuto

 

new string[20];

new string2[80];

 

GetPlayerName(playerid,string,sizeof(string));

 

format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

 

mam pridat barvu ? me to ve hre neukaze

Link to comment
Share on other sites

Pls kde ktomuto

 

new string[20];

new string2[80];

 

GetPlayerName(playerid,string,sizeof(string));

 

format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

 

mam pridat barvu ? me to ve hre neukaze

SendClientMessage(playerid, BARVA, string2);

Link to comment
Share on other sites

Pls kde ktomuto

 

new string[20];

new string2[80];

 

GetPlayerName(playerid,string,sizeof(string));

 

format(string2,sizeof(string2),"Hrac se jmenuje %s",string);

 

mam pridat barvu ? me to ve hre neukaze

SendClientMessage(playerid, BARVA, string2);

 

Dik moc :) aspon ty mi poradis

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...