Jump to content

[0.2x | 0.3a] Random messages


Razvann

Recommended Posts

Multi va intrebati cum fac sa apara mesaje la intamplare intr-un anumit timp. O sa va arat cum puteti face acest script.

Prima data creati o variabila globala, ca aici:

new randomtimer;
Adaugati forwardul:
forward RandomMsgs();
Apoi, setati variabila sa se repete la un anumit timp, puneti la OnGameModeInit:
randomtimer = SetTimer("RandomMsgs", timpul in milsecunde*, 1);
Creat callbackul:
public RandomMsgs()
{
new rand = random(catemesajeaveti)+1; msgs = rand; RandomMsgs2();
return 1;
}
Creati o alta variabila globala, de aceasta data asa:
new msgs = 0;
Creati forwardul:
forward RandomMsgs2();
Si apoi callbackul:
public RandomMsgs2()
{
new string[256];
new stringmsg[256];
if(msgs == 1) 
{ 
stringmsg = "Salut !"; 
}
if(msgs == 2) 
{ 
stringmsg = "La revedere !"; // si asa mai departe
}
format(string, sizeof(string), "%s", stringmsg);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}

Raportati greselile aici.

________________________________________________________

* = timpul in milisecunde (60000 = 1min).

Link to comment
Share on other sites

  • 5 months later...

PFFF E Prea greu cum ai explicat ma eu stiam un mod simplu da simplu de tot....

Uite unu simplu de tot.

//OnGameModeInit
SetTimer("Mesaje", 1, 10*60000);

//Undeva
forward Mesaje();
public Mesaje()
{
    switch( random( 5 ) )
    {
       //Sunt 5 case, (nu locuinte) Numarul de sus trebuie sa coincide cu numarule de 'case'
        case 0:SendClientMessage( playerid, 0x00000000, "Mesaj 1");
        case 1:SendClientMessage( playerid, 0x00000000, "Mesaj 2");
        case 2:SendClientMessage( playerid, 0x00000000, "Mesaj 3");
        case 3:SendClientMessage( playerid, 0x00000000, "Mesaj 4");
        case 4:SendClientMessage( playerid, 0x00000000, "Mesaj 5");
     }
}

Link to comment
Share on other sites

Este bun,bv dar destul de complicat.. adica ma refer ca exista FS-uri care indeplinesc aceasta functie...ce o sa aleaga o anumita persoana ? aceasta bataie de cap? sau un simplu FS care modifica dansul/dansa ce doresc? oricum Bv !

Deci chiar nu inteleg ce ai vrut sa zici ... si apropo foarte josnic pentru faza cu cerutul FS cu speedo si dupa il postezi ... Ce rost aveA? sa zici ca postezi si u scripturi ... nea esti paralel cu scriptingul ... parerea mea LASATE sau macar apucate ...

16189165.gifrastamaunbydeejaylobo1.gifsmileysw0181.gif

xmsok6ay41.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.