how to turn an strcmp cmd in an dcmd cmd ???
#1

how to make this commands dcmd ?
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256],tmp[256], tmp2[256], idx, string[256];
  cmd = strtok(cmdtext, idx);
  
  if(strcmp(cmd, "/register", true) == 0)
  {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /register (password)");
    }
    else
    {
      if (!dini_Exists(udb_encode(pInfo[playerid][name])))
      {
      	dini_Create(udb_encode(pInfo[playerid][name]));
		 		dini_IntSet(udb_encode(pInfo[playerid][name]), "password", udb_hash(tmp));
        OnPlayerRegister(playerid);
        format(string, sizeof(string), "Account %s aangemaakt! Je kunt nu inloggen met het wachtwoord: %s.", pInfo[playerid][name], tmp);
        SendClientMessage(playerid, COLOR_YELLOW, string);
      }
      else
      {
        format(string, sizeof(string), "%s already registered.", pInfo[playerid][name],tmp);
        SendClientMessage(playerid, COLOR_RED, string);
      }
    }
    return 1;
  }


  if(strcmp(cmd, "/login", true) == 0)
  {
    if(pInfo[playerid][logged] == 1)
    {
      SendClientMessage(playerid, COLOR_RED, "Je bent al ingelogd");
      return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
      SendClientMessage(playerid, COLOR_YELLOW, "Gebruik: /login (wachtwoord)");
    }
    else
    {
      if (dini_Exists(udb_encode(pInfo[playerid][name])))
      {
        tmp2 = dini_Get(udb_encode(pInfo[playerid][name]), "password");
        if (udb_hash(tmp) != strval(tmp2))
        {
          SendClientMessage(playerid, COLOR_RED, "Verkeerd wachtwoord!.");
        }
        else
        {
          OnPlayerLogin(playerid);
          format(string, sizeof(string), "%s, je bent nu ingelogd. Level: %d, Money: %d, Score: %d", pInfo[playerid][name], pInfo[playerid][level], pInfo[playerid][money], pInfo[playerid][score]);
					SendClientMessage(playerid, COLOR_GREEN, string);
        }
      }
      else
      {
        format(string, sizeof(string), "Het account %s, bestaat nog niet. Typ /register [wachtwoord] om een account te maken.", pInfo[playerid][name]);
        SendClientMessage(playerid, COLOR_RED, string);
      }
    }
    return 1;
  }

  return 0;
}
Reply
#2

Check some dcmd tutorials out there, but it's better if you use zcmd - it's faster.
Reply
#3

Quote:
Originally Posted by Don Correlli
Check some dcmd tutorials out there, but it's better if you use zcmd - it's faster.
fine for you, but i asking for DCMD, i don't use experimental stuff, in my game mode.
Reply
#4

Like i already told you:
Quote:
Originally Posted by Don Correlli
Check some dcmd tutorials out there
http://forum.sa-mp.com/index.php?topic=70925.0
Reply
#5

nothing in that topic that me can help............................
Reply
#6

Quote:
Originally Posted by Crusher!!
nothing in that topic that me can help............................
Then i can't help you if you can't understand what's in that topic.
Reply
#7

You can ask someone to do it in Script Request Thread.
Reply
#8

Quote:
Originally Posted by MenaceX^
You can ask someone to do it in Script Request Thread.
I know the define for DCMD its just the passwords are my problem.

76 poeples has see this and noboddy can set my strcmp command to dcmd
IS THIS AN JOKE , so yes it is'nt funny
Reply
#9

damm you don't understand and i think because me english is an little bit bad....
Reply
#10

Follow these links and you should have everything you need in order to convert your command into zcmd (which, as ****** said, is not "experimental"):

Sscanf: https://sampwiki.blast.hk/wiki/Sscanf
Some more on sscanf: https://sampwiki.blast.hk/wiki/Fast_Commands#sscanf
A script using an older version of zcmd (use command/cmd in place of zcmd when making a command) and sscanf, it is fully annotated to help you understand: http://pastebin.com/f5d480b71
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)