Muže mi někdo do p*dele vysvětlit proč mi Timer nefunguje, když tam nemám žádne errory? Jako všechny errory, které tam byly jsem opravil ale tohle nechápu, když budete vědet co s tím dejte vědět.
Nahoře v modu:
new RandomCode1[MAX_PLAYERS];
new RandomCode2[MAX_PLAYERS];
new RandomCode3[MAX_PLAYERS];
new RandomCodeStopTimer[MAX_PLAYERS];
forward Help(playerid);
forward RandomCode();
forward RandomCodeStop();
Vytvořil jsem samostatné publiky:
public RandomCode()
{
new string[256];
new rcode = random(3);
switch(rcode)
{
case 0:
{
for (new i = 0; i < GetMaxPlayers(); i++)
{
RandomCode1[i] = 1;
RandomCodeStopTimer[i] = SetTimer("RandomCodeStop", 120000, false);
}
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[i] = 1;
RandomCodeStopTimer[i] = SetTimer("RandomCodeStop", 120000, false);
}
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 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.
}
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;
}
public RandomCodeStop()
{
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++)
{
RandomCode1[i] = 0;
RandomCode2[i] = 0;
RandomCode3[i] = 0;
}
}
return 0;
}
Potom jsem přidal texty nasledně do OnPlayerText() jsem přidal tohle:
new string[120];
new Jmeno[MAX_PLAYER_NAME];
GetPlayerName(playerid,Jmeno,sizeof(Jmeno));
if(RandomCode1[playerid] == 1)
{
if(!strcmp(text, "a5bXOq56i", true))
{
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);
for (new i = 0; i < GetMaxPlayers(); i++)
{
KillTimer(RandomCodeStopTimer[i]);
RandomCode1[i] = 0;
}
}
}
if(RandomCode2[playerid] == 1)
{
if(!strcmp(text, "eBo13zEtp", true))
{
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);
for (new i = 0; i < GetMaxPlayers(); i++)
{
KillTimer(RandomCodeStopTimer[i]);
RandomCode2[i] = 0;
}
}
}
if(RandomCode3[playerid] == 1)
{
if(!strcmp(text, "fIXk54fg6", true))
{
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);
for (new i = 0; i < GetMaxPlayers(); i++)
{
KillTimer(RandomCodeStopTimer[i]);
RandomCode3[i] = 0;
}
}
}
A ted k tomu problému. Nic to nepíše maximalně když du na server tak to nic neděla nic to nepíše. Prosím o pomoc
Dotaz
LemoNSK 0
Muže mi někdo do p*dele vysvětlit proč mi Timer nefunguje, když tam nemám žádne errory? Jako všechny errory, které tam byly jsem opravil ale tohle nechápu, když budete vědet co s tím dejte vědět.
Nahoře v modu:
Vytvořil jsem samostatné publiky:
Potom jsem přidal texty nasledně do OnPlayerText() jsem přidal tohle:
A ted k tomu problému. Nic to nepíše maximalně když du na server tak to nic neděla nic to nepíše. Prosím o pomoc
Link to comment
Share on other sites
4 odpovědí na tuto otázku
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now