Jump to content

Cerere sistem editare jucator MYSQL.


m0untain

Recommended Posts

  • 4 years later...

1. Primadata trebuie sa pui plugin-ul mysql in server.cfg

Windows: plugins mysql

Sau

Linux: plugins mysql.so

(cred ca ai deja pus, dar am pus de siguranta).

2. Comanda:

Pentru strcmp (adica in OnplayerCommandText): new cmd[256], arg[256];

 

 new cmd[256], arg[256]; 

 if (sscanf(cmdtext, "s[256]S()[256]", cmd, arg)) return 0;

 

 else if (strcmp(cmd, "/mcontrol", true) == 0)

 {

  ShowPlayerDialog(playerid, DIALOG_EDIT_PLAYER, DIALOG_STYLE_LIST, "Player Edit", "Admin\nCoins\nGems", "Edit", "Cancel");

  return 1;

 }

 

Pt celelalte (ZCMD, etc): 

CMD:mcontrol(playerid, params[]) {

ShowPlayerDialog(playerid, DIALOG_EDIT_PLAYER, DIALOG_STYLE_LIST, "Player Edit", "Admin\nCoins\nGems", "Edit", "Cancel");

return 1;}

3. OnDialogResponse

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

 if (dialogid == DIALOG_EDIT_PLAYER)

 {

  if (response)

  {

   new playerToEdit[MAX_PLAYER_NAME];

            format(playerToEdit, sizeof(playerToEdit), "%s", inputtext);

            switch (listitem)

            {

    case 0: // Admin

     new query[256];

                    format(query, sizeof(query), "UPDATE players SET admin = 1 WHERE name = '%s'", playerToEdit);

                    mysql_query(query);

                    break;

    case 1: // Coins

                    format(query, sizeof(query), "UPDATE players SET coins = 100 WHERE name = '%s'", playerToEdit);

                    mysql_query(query);

                    break;

    case 2: // Gems

                    format(query, sizeof(query), "UPDATE players SET gems = 100 WHERE name = '%s'", playerToEdit);

                    mysql_query(query);

                    break;

   }

  }

 }

 

Cam atat, dupa gems poti sa mai creezi tu dupa același model, eu nu am făcut mai multe pentru că nu știu ce mai ai tu în baza de date a gamemode-ului tău.

Sper că te-am ajutat, spor.

(probabil nu te-am ajutat ca esti inactiv pe forum =)), dar poate am ajutat pe altcnv).

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.