Szerző Téma: Automatikus parancslefutás  (Megtekintve 588 alkalommal)

Automatikus parancslefutás
« Dátum: 2011. Október 12. - 18:01:27 »
0 Show voters
Uf!
Hogy tudom megoldani ,hogy pl. a /xyzr parancs 30 percenként automatikusan lefusson?
A válaszokat elõre is köszi  ;)

Automatikus parancslefutás
« Válasz #1 Dátum: 2011. Október 12. - 18:06:11 »
0 Show voters
Letudnád másolni a parancsot?

Automatikus parancslefutás
« Válasz #2 Dátum: 2011. Október 12. - 18:08:28 »
0 Show voters
[pawn]   if(strcmp(cmd, \"/sorsol\", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {
            format(string, sizeof(string), \"LOTTÓ: Elkezdtük a sorsolást!\");
            OOCOff(COLOR_DBLUE, string);
            new rand = random(80);
            if(rand < 77) { rand += 3; }
            Lotto(rand);
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, \"   Nem vagy admin....\");
            return 1;
        }
    }
   return 1;
}[/pawn]

Automatikus parancslefutás
« Válasz #3 Dátum: 2011. Október 12. - 18:43:07 »
0 Show voters
OnFilterScriptInIt vagy OnGameModeInit alá:
[pawn]SetTimer(\"autocmds\",1000*60*30,1);[/pawn]
Script aljára:
[pawn]forward autocmds();
public autocmds()
{
new playerid;
OnPlayerCommandText(playerid,\"/sorsol\");
return 1;
}[/pawn]
Ezzel a parancs 100%-a lefut.
Hogy jó e nemtom, de asszem így kell csinálni... Vagy ha nem jó, akkor:
[pawn]forward autocmds();
public autocmds()
{
new string[128];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), \"LOTTÓ: Elkezdtük a sorsolást!\");
SendClientMessage(i,COLOR_DBLUE, string);
new rand = random(80);
if(rand < 77) { rand += 3; }
Lotto(rand);
}
}
return 1;
}[/pawn]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal