Jump to content
  • 0

pomoc Nahodný text


slayer97

Dotaz

ahoj, našel sem tu návod na "Náhodný text", ale mám tam pár erroru a nevím co snima..

..

C:\Users\Zdenda\Desktop\text.pwn(142) : error 017: undefined symbol "string"
C:\Users\Zdenda\Desktop\text.pwn(142) : error 017: undefined symbol "string"
C:\Users\Zdenda\Desktop\text.pwn(142) : error 029: invalid expression, assumed zero
C:\Users\Zdenda\Desktop\text.pwn(142) : fatal error 107: too many error messages on one line
 
to je na řádku
 
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' a5bXOq56i '' hráč %s získal {33AA33}$50 000{FFFFFF}.",Jmeno(playerid));
 
Help pls...
Link to comment
Share on other sites

8 odpovědí na tuto otázku

Recommended Posts

  • 0

Máš uvozovky v uvozovkách. A new string[100] snad máš ne?

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text \'' a5bXOq56i \'' hráč %s získal {33AA33}$50 000{FFFFFF}.",Jmeno(playerid));
Link to comment
Share on other sites

  • 0
C:\Users\Zdenda\Desktop\text.pwn(144) : error 012: invalid function call, not a valid address

C:\Users\Zdenda\Desktop\text.pwn(144) : warning 215: expression has no effect

C:\Users\Zdenda\Desktop\text.pwn(144) : error 001: expected token: ";", but found ")"

C:\Users\Zdenda\Desktop\text.pwn(144) : error 029: invalid expression, assumed zero

C:\Users\Zdenda\Desktop\text.pwn(144) : fatal error 107: too many error messages on one line

 

na stejném řádku...

Link to comment
Share on other sites

  • 0
#include <a_samp>

#if defined FILTERSCRIPT

 

new RandomCode1[MAX_PLAYERS]; // Náhodný text číslo 1.

new RandomCode2[MAX_PLAYERS]; // Náhodný text číslo 2.

new RandomCode3[MAX_PLAYERS]; // Náhodný text číslo 3.

new RandomCodeStopTimer[MAX_PLAYERS]; // Pro Timer který vypne náhodný text

 

forward RandomCode(); // Forward.

 

public OnFilterScriptInit()

{

SetTimer("RandomCode", 600000, true); // 600000 = 10 minut

return 0;

}

 

public RandomCode()

{

new string[256];

new rcode = random(3); // Vybere jeden ze 3 nahodných textu.

switch(rcode)

{

case 0:

{

for (new i = 0; i < GetMaxPlayers(); i++) {

RandomCode1 = 1;

RandomCodeStopTimer = SetTimer("RandomCodeStop", 120000, false); // Za 2 minuty náhodný text vypne pokud nikdo neodpovi.

} // Zapne všem hráčum náhodný text číslo 1 a stop timer.

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Kdo první napíše náhodný text do 2m. '' a5bXOq56i '' získá {33AA33}$50 000{FFFFFF}.");

SendClientMessageToAll(0xFFFFFFAA,string);

}

case 1:

{

for (new i = 0; i < GetMaxPlayers(); i++) {

RandomCode2 = 1;

RandomCodeStopTimer = SetTimer("RandomCodeStop", 120000, false); // Za 2 minuty náhodný text vypne pokud nikdo neodpovi.

} // Zapne všem hráčum náhodný text číslo 2 a stop timer.

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Kdo první napíše náhodný text do 2m. '' eBo13zEtp '' získá {33AA33}$55 000{FFFFFF}.");

SendClientMessageToAll(0xFFFFFFAA,string);

}

case 3:

{

for (new i = 0; i < GetMaxPlayers(); i++) {

RandomCode3 = 1;

RandomCodeStopTimer = SetTimer("RandomCodeStop", 120000, false); // Za 2 minuty náhodný text vypne pokud nikdo neodpovi.

} // Zapne všem hráčum náhodný text číslo 3 a stop timer.

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Kdo první napíše náhodný text do 2m. '' fIXk54fg6 '' získá {33AA33}$35 000{FFFFFF}.");

SendClientMessageToAll(0xFFFFFFAA,string);

}

}

return 1;

}

forward RandomCodeStop(); // Forward.

public RandomCodeStop() // Tento Public nastaví hodnoty RandomCode 1-3 na 0 ciže kdo napíše náhodný text po 2 minutách nic to neudělá.

{

SendClientMessageToAll(-1, "[ {C2A2DA}Text{FFFFFF} ] Nikdo nenapsal náhodný text do 2 minut, náhodný text byl zrušen.");

for (new i = 0; i < GetMaxPlayers(); i++) { // Nastaví všem hráčum na serveru na 0.

RandomCode1 = 0; // Vypne náhodný text číslo 1.

RandomCode2 = 0; // Vypne náhodný text číslo 2.

RandomCode3 = 0; // Vypne náhodný text číslo 3.

}

return 0;

}

 

public OnPlayerText(playerid, text[])

{

new string[128];

new Jmeno[MAX_PLAYER_NAME];

if(RandomCode1[playerid] == 1){ // Pokud je zapnutý.

if(!strcmp(text, "a5bXOq56i", true)) // Napíše tento text do chatu.

{

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' a5bXOq56i '' hráč %s získal {33AA33}$50 000{FFFFFF}.",Jmeno(playerid));

SendClientMessageToAll(0xFFFFFFAA,string);

GivePlayerMoney(playerid, 50000); // Dá peníze.

for (new i = 0; i < GetMaxPlayers(); i++) // Pro všechny hráče.

{

KillTimer(RandomCodeStopTimer); // Zruší timer který měl za 2 minuty vypnout náhodný text nebot hráč už odpovědel.

RandomCode1 = 0; // Nastaví na 0 ciže na vypnuto pokud jeden z hráču napíše dobře jako první.

}

}

}

//

if(RandomCode2[playerid] == 1){ // Pokud je zapnutý.

if(!strcmp(text, "eBo13zEtp", true)) // Napíše tento text do chatu.

{

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' eBo13zEtp '' hráč %s získal {33AA33}$55 000{FFFFFF}.",Jmeno(playerid));

SendClientMessageToAll(0xFFFFFFAA,string);

GivePlayerMoney(playerid, 55000); // Dá peníze.

for (new i = 0; i < GetMaxPlayers(); i++) // Pro všechny hráče.

{

KillTimer(RandomCodeStopTimer); // Zruší timer který měl za 2 minuty vypnout náhodný text nebot hráč už odpovědel.

RandomCode2 = 0; // Nastaví na 0 ciže na vypnuto pokud jeden z hráču napíše dobře jako první.

}

}

}

//

if(RandomCode3[playerid] == 1){ // Pokud je zapnutý.

if(!strcmp(text, "fIXk54fg6", true)) // Napíše tento text do chatu.

{

format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' fIXk54fg6 '' hráč %s získal {33AA33}$35 000{FFFFFF}.",Jmeno(playerid));

SendClientMessageToAll(0xFFFFFFAA,string);

GivePlayerMoney(playerid, 35000); // Dá peníze.

for (new i = 0; i < GetMaxPlayers(); i++) // Pro všechny hráče.

{

KillTimer(RandomCodeStopTimer); // Zruší timer který měl za 2 minuty vypnout náhodný text nebot hráč už odpovědel.

RandomCode3 = 0; // Nastaví na 0 ciže na vypnuto pokud jeden z hráču napíše dobře jako první.

return 1;

}

 

#endif

 

tu je celý stejně mám to bez erroru ale stejně to na serveru nic neudělá

Link to comment
Share on other sites

  • 0


#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
new RandomCode1[MAX_PLAYERS]; // Náhodný text číslo 1.
new RandomCode2[MAX_PLAYERS]; // Náhodný text číslo 2.
new RandomCode3[MAX_PLAYERS]; // Náhodný text číslo 3.
new RandomCodeStopTimer[MAX_PLAYERS]; // Pro Timer který vypne náhodný text

forward RandomCode(); // Forward.

public OnFilterScriptInit()
{
SetTimer("RandomCode", 1000, true); // 600000 = 10 minut
printf("wtf");
return 1;
}

public RandomCode()
{
printf("Random code");
new string[256];
new rcode = random(3); // Vybere jeden ze 3 nahodných textu.
switch(rcode)
{
case 0:
{
printf("case 0");
for (new i = 0; i < GetMaxPlayers(); i++) {
RandomCode1[i] = 1;
RandomCodeStopTimer[i] = SetTimer("RandomCodeStop", 120000, false); // Za 2 minuty náhodný text vypne pokud nikdo neodpovi.
} // Zapne všem hráčum náhodný text číslo 1 a stop timer.
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Kdo první napíše náhodný text do 2m. '' a5bXOq56i '' získá {33AA33}$50 000{FFFFFF}.");
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
case 1:
{
printf("case 1");
for (new i = 0; i < GetMaxPlayers(); i++) {
RandomCode2[i] = 1;
RandomCodeStopTimer[i] = SetTimer("RandomCodeStop", 120000, false); // Za 2 minuty náhodný text vypne pokud nikdo neodpovi.
} // Zapne všem hráčum náhodný text číslo 2 a stop timer.
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Kdo první napíše náhodný text do 2m. '' eBo13zEtp '' získá {33AA33}$55 000{FFFFFF}.");
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
case 2:
{
printf("case 2");
for (new i = 0; i < GetMaxPlayers(); i++) {
RandomCode3[i] = 1;
RandomCodeStopTimer[i] = SetTimer("RandomCodeStop", 120000, false); // Za 2 minuty náhodný text vypne pokud nikdo neodpovi.
} // Zapne všem hráčum náhodný text číslo 3 a stop timer.
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Kdo první napíše náhodný text do 2m. '' fIXk54fg6 '' získá {33AA33}$35 000{FFFFFF}.");
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
}
return 1;
}
forward RandomCodeStop(); // Forward.
public RandomCodeStop() // Tento Public nastaví hodnoty RandomCode 1-3 na 0 ciže kdo napíše náhodný text po 2 minutách nic to neudělá.
{
SendClientMessageToAll(-1, "[ {C2A2DA}Text{FFFFFF} ] Nikdo nenapsal náhodný text do 2 minut, náhodný text byl zrušen.");
for (new i = 0; i < GetMaxPlayers(); i++) { // Nastaví všem hráčum na serveru na 0.
RandomCode1[i] = 0; // Vypne náhodný text číslo 1.
RandomCode2[i] = 0; // Vypne náhodný text číslo 2.
RandomCode3[i] = 0; // Vypne náhodný text číslo 3.
}
return 1;
}

public OnPlayerText(playerid, text[])
{
new string[128];
new Jmeno[MAX_PLAYER_NAME];
GetPlayerName(playerid,Jmeno,sizeof(Jmeno));
if(RandomCode1[playerid] == 1){ // Pokud je zapnutý.
if(!strcmp(text, "a5bXOq56i", true)) // Napíše tento text do chatu.
{
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' a5bXOq56i '' hráč %s získal {33AA33}$50 000{FFFFFF}.",Jmeno);
SendClientMessageToAll(0xFFFFFFAA,string);
GivePlayerMoney(playerid, 50000); // Dá peníze.
for (new i = 0; i < GetMaxPlayers(); i++) // Pro všechny hráče.
{
KillTimer(RandomCodeStopTimer[i]); // Zruší timer který měl za 2 minuty vypnout náhodný text nebot hráč už odpovědel.
RandomCode1[i] = 0; // Nastaví na 0 ciže na vypnuto pokud jeden z hráču napíše dobře jako první.
return 1;
}
}
}


//
if(RandomCode2[playerid] == 1){ // Pokud je zapnutý.
if(!strcmp(text, "eBo13zEtp", true)) // Napíše tento text do chatu.
{
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' eBo13zEtp '' hráč %s získal {33AA33}$55 000{FFFFFF}.",Jmeno);
SendClientMessageToAll(0xFFFFFFAA,string);
GivePlayerMoney(playerid, 55000); // Dá peníze.
for (new i = 0; i < GetMaxPlayers(); i++) // Pro všechny hráče.
{
KillTimer(RandomCodeStopTimer[i]); // Zruší timer který měl za 2 minuty vypnout náhodný text nebot hráč už odpovědel.
RandomCode2[i] = 0; // Nastaví na 0 ciže na vypnuto pokud jeden z hráču napíše dobře jako první.
return 1;
}
}
}

//
if(RandomCode3[playerid] == 1){ // Pokud je zapnutý.
if(!strcmp(text, "fIXk54fg6", true)) // Napíše tento text do chatu.
{
format(string, sizeof(string), "[ {C2A2DA}Text{FFFFFF} ] Jako první napsal náhodný text '' fIXk54fg6 '' hráč %s získal {33AA33}$35 000{FFFFFF}.",Jmeno);
SendClientMessageToAll(0xFFFFFFAA,string);
GivePlayerMoney(playerid, 35000); // Dá peníze.
for (new i = 0; i < GetMaxPlayers(); i++) // Pro všechny hráče.
{
KillTimer(RandomCodeStopTimer[i]); // Zruší timer který měl za 2 minuty vypnout náhodný text nebot hráč už odpovědel.
RandomCode3[i] = 0; // Nastaví na 0 ciže na vypnuto pokud jeden z hráču napíše dobře jako první.
return 1;
}
}
}
return 0;
}

#endif

 

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