Jump to content
  • 0

pomoc Počasí - příkaz


mrcrowwinn

Dotaz

Zdravím, když napíšu příkaz

 

/weather 10

 

a řádek vypadá takle

 

if (strcmp("/weather 10", cmdtext, true) == -1)
{
SetPlayerWeather(playerid, 10);
SendClientMessage(playerid,COLOR_GREEN,"Počasí je 10");
return 1;
}

 

Tak mi to Udělá počasí s ID 1

 

Proč? :ble:

Link to comment
Share on other sites

14 odpovědí na tuto otázku

Recommended Posts

  • 0
Zdravím, když napíšu příkaz

 

/weather 10

 

a řádek vypadá takle

 

if (strcmp("/weather 10", cmdtext, true) == -1)
{
SetPlayerWeather(playerid, 10);
SendClientMessage(playerid,COLOR_GREEN,"Počasí je 10");
return 0;
}

 

Tak mi to Udělá počasí s ID 1

 

Proč? :ble:

V STRCMP nemůžeš mít mezery protože bere jen to první slovo tudíž to bere všechno dohromady(všechny příkazy které začínají weather), tím pádem to můžeš udělat např. takto /weather10 nebo /weather-10

 

if (strcmp("/weather-10", cmdtext, true))
{
SetPlayerWeather(playerid, 10);
SendClientMessage(playerid, COLOR_GREEN, "Počasí je 10");
return 0;
}

Link to comment
Share on other sites

  • 0

Když jsem to zkusil, a dal jsem to pro ID 11, tak zase házelo počasí 10.

if (strcmp("/weather-11", cmdtext, true, 11) == 0)
{
SetPlayerWeather(playerid,11);
SendClientMessage(playerid,COLOR_GREEN,"Počasí je 11");
return 1;
}

Link to comment
Share on other sites

  • 0

Chytáte za slovíčka, jo? :d Ne teď doopravdy, potřeboval bych tam všechno počasí co je. Tzn. ID = 1-40. Vůbec nevím jak na to... Rouvnou bych to dal jako FS. páč jsem to tam hledal a nemohl jsem to najít.

Link to comment
Share on other sites

  • 0

V STRCMP nemůžeš mít mezery protože bere jen to první slovo tudíž to bere všechno dohromady(všechny příkazy které začínají weather), tím pádem to můžeš udělat např. takto /weather10 nebo /weather-10

[/code]

netrep kok*tiny, strcmp porovnava zhodu stringov a nedba na medzery či hoci japonske znaky

 

a ak neviete dcmd tiez pouziva strcmp :facepalm:

 

btw

if(!strcmp("/weather", cmdtext, true, 8))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

Link to comment
Share on other sites

  • 0

V STRCMP nemůžeš mít mezery protože bere jen to první slovo tudíž to bere všechno dohromady(všechny příkazy které začínají weather), tím pádem to můžeš udělat např. takto /weather10 nebo /weather-10

[/code]

netrep kok*tiny, strcmp porovnava zhodu stringov a nedba na medzery či hoci japonske znaky

 

a ak neviete dcmd tiez pouziva strcmp :facepalm:

 

btw

if(!strcmp("/weather", cmdtext, true, 8))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

 

Když jsem tam dal tento kod

if(!strcmp("/weather", cmdtext, true, 8))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

Server padnul - zkouším po lokálu.

Link to comment
Share on other sites

  • 0

 

V STRCMP nemůžeš mít mezery protože bere jen to první slovo tudíž to bere všechno dohromady(všechny příkazy které začínají weather), tím pádem to můžeš udělat např. takto /weather10 nebo /weather-10

[/code]

netrep kok*tiny, strcmp porovnava zhodu stringov a nedba na medzery či hoci japonske znaky

 

a ak neviete dcmd tiez pouziva strcmp :facepalm:

 

btw

if(!strcmp("/weather", cmdtext, true, 8))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

 

Když jsem tam dal tento kod

if(!strcmp("/weather", cmdtext, true, 8))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

Server padnul - zkouším po lokálu.

 

to pretoze si tam nezadal parametre, napr /weather 8, daj si tam podmienku

 

 

if(!strcmp("/weather", cmdtext, true, 8) && (strlen(cmdtext) >= 10))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

 

Link to comment
Share on other sites

  • 0

to pretoze si tam nezadal parametre, napr /weather 8, daj si tam podmienku

 

 

if(!strcmp("/weather", cmdtext, true, 8) && (strlen(cmdtext) >= 10))
{
  SetPlayerWeather(playerid, strval(cmdtext[9]));
  new str[64];
  format(str, 64, "Počasí je %d", strval(cmdtext[9]));
  SendClientMessage(playerid,COLOR_GREEN,str);
  return 1;
}

 

 

Super už to jde. Moc díky! Můžu to dát na pawno do FS? S tvým jménem?

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...