Jump to content

[5]Cum sa faci o comanda pe STRCMP


Gireada

Recommended Posts

In primul rand, STRCMP nu este un procesor de comenzi. Este o functie prin care se compara doua text, iar pus in callback-ul OnPlayerCommandText, compara doua comenzi.

Sa incepem.

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/me", true, 3)) // 3 = lungimea lui /me fiind trei caractere
    {
        SendClientMessage(playerid, -1, "Tutorial");
        return 1;
    }
    return 0;
}

Aceasta este o comanda simpla.

Observatie ultimul return trebuie sa fie neaparat 0 iar dupa terminarea fiecarei comenzi trebuie pus return 1;

O sa explic ce face fiecare return. Daca este return 1; comanda a fost gasit OnPlayerCommandText nu mai cauta comenzi. Iar ultimul return 0; na lasa sa cautam comenzile si in filescript-uri, daca ultmul return era 1 puteam folosi doar comenzile din gamemode.

Daca nu ati inteles va rog lasati replay.

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

Link to comment
Share on other sites

  • 1 month later...

poti sa faci comanda pe zcmd sau dcmd prin PUBLIC: ... nu sunt obisnuit cu cele enumerate. strcmp mie prea cunoscut... Mai ales cu update-urile noi ,mie greu sa le mai scriptez deoarece nu am mai scriptat de cand a aparut 0.3c + ca lucrez de o saptamana la un RPG original. Scuze ca am reaprins topicul, dar chiar vreau sa le stiu

samp.g-promote.ro cel mai tare server!

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 months later...
  • 2 months later...

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.