SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 20/09/2009, 06:27 PM   #1
virtualmarc
Little Clucker
 
Join Date: Aug 2008
Posts: 33
Reputation: 0
Default SERVER: Unknown Command - after login on every command

Hallo,
If I login to my Server it says on every command:
Quote:
SERVER: Unknows Command
But if I dont login I can use other Commands (/help)

Here my Code:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new val[128],cmd[256],idx,plname[100],chkqry[100],plcnt,insqry[100],pwcnt,selqry[255],line[1024];
  cmd = strtok(cmdtext,idx);
  // Hilfe
  if(strcmp("/help", cmd, true) == 0)
  {
    SendClientMessage(playerid, FARBE_AQUA, "*****[HILFE]*****");
    SendClientMessage(playerid, FARBE_WEISS, "BENUTZER: /reg, /login");
    return 1;
  }
  // Registration
  if(strcmp("/reg", cmd, true) == 0)
  {
    val = strvalue(cmdtext,idx);
    if(!val[0])
    {
      // Es wurde kein Parameter angegeben
      SendClientMessage(playerid,0xFFFFFFFF,"Benutzung: /reg [PASSWORT]");
    }
    else
    {
      // Parameter wurde angegeben
      // Spielername herausfinden
      GetPlayerName(playerid, plname, sizeof(plname));
      // Überprüfen ob Spieler schon existiert
      format(chkqry,sizeof(chkqry),"SELECT * FROM user WHERE name='%s'", plname);
      samp_mysql_query(chkqry);
      samp_mysql_store_result();
      plcnt=samp_mysql_num_rows();
      if(plcnt == 1)
      {
        // Spieler existiert bereits
        // Aufforderung zum einloggen anzeigen!
         SendClientMessage(playerid, FARBE_ROT, "Es existiert bereits ein Account mit diesem Namen!");
         SendClientMessage(playerid, FARBE_ROT, "Bitte /login [PASSWORT] benutzen!");
      }
      else
      {
        // Spieler existiert nicht
        // Spieler registrieren
        samp_mysql_real_escape_string(plname, plname);
        format(insqry,sizeof(insqry),"INSERT INTO user (name,pass,mail, money) VALUES ('%s',MD5('%s'), 'none', '500')", plname, val[0]);
        samp_mysql_query(insqry);
        // ID auslesen
        format(selqry,sizeof(selqry),"SELECT * FROM user WHERE name='%s'", plname);
        samp_mysql_query(selqry);
        samp_mysql_store_result();
        samp_mysql_fetch_row(line);
        new SpDv[30][50];
          split(line, SpDv, '|');
          // Konto eröffnen
          format(insqry,sizeof(insqry),"INSERT INTO konten (playerid,betrag) VALUES ('%s','100')", SpDv[0]);
        samp_mysql_query(insqry);
        // Registration fertig
        SendClientMessage(playerid, FARBE_ROT, "Registration erfolgreich!");
        // Aufforderung zum einloggen anzeigen
        SendClientMessage(playerid, FARBE_ROT, "Benutzen Sie /login [PASSWORT] um sich einzuloggen!");
      }
    }
    return 1;
  }
  // Login
  if(strcmp("/login", cmd, true) == 0)
  {
    val = strvalue(cmdtext,idx);
    if(!val[0])
    {
      // Es wurde kein Parameter angegeben
      SendClientMessage(playerid,0xFFFFFFFF,"Benutzung: /login [PASSWORT]");
    }
    else
    {
       //Parameter wurde angegeben
       // Spielername herausfinden
      GetPlayerName(playerid, plname, sizeof(plname));
      // Überprüfen ob Spieler schon registriert ist
      format(chkqry,sizeof(chkqry),"SELECT * FROM user WHERE name='%s'", plname);
      samp_mysql_query(chkqry);
      samp_mysql_store_result();
      plcnt=samp_mysql_num_rows();
      if(plcnt == 1)
      {
        // Spieler ist registriert
        // Prüfen ob das Passwort stimmt
         format(chkqry,sizeof(chkqry),"SELECT * FROM user WHERE (name='%s' AND pass=MD5('%s'))", plname, val[0]);
        samp_mysql_query(chkqry);
        samp_mysql_store_result();
        pwcnt=samp_mysql_num_rows();
        if(pwcnt == 1)
        {
          // Passwort stimmt
          SendClientMessage(playerid, FARBE_ROT, "Sie sind erfolgreich eingeloggt!");
          // Loginvariablen setzen
          SpielerInfo[playerid][login] = 1;
          // Geld setzten
          format(chkqry,sizeof(chkqry),"SELECT * FROM user WHERE name='%s'", plname);
          samp_mysql_query(chkqry);
            samp_mysql_store_result();
          new line[1024];
          samp_mysql_fetch_row(line);
          new SpDv[30][50];
            split(line, SpDv, '|');
          SpielerInfo[playerid][startmoney] = strval(SpDv[5]);
          SpielerInfo[playerid][dbid] = strval(SpDv[0]);
          //SetPlayerMoney(playerid, SpielerInfo[playerid][startmoney]);
          new testmoney[255];
          testmoney = "500";
          SetPlayerMoney(playerid,SpielerInfo[playerid][startmoney]);
                    new ausg[255];
                    format(ausg,sizeof(ausg),"Spielergeld: %d",SpielerInfo[playerid][startmoney]);
                    print(ausg);
        }
        else
        {
          // Passwort stimmt nicht
          SendClientMessage(playerid, FARBE_ROT, "Das Passwort war falsch!");
        }
      }
      else
      {
        // Spieler ist noch nicht registriert
        SendClientMessage(playerid, FARBE_ROT, "Es existiert noch lein Account mit diesem Namen!");
        // Aufforderung zum registrieren anzeigen
         SendClientMessage(playerid, FARBE_ROT, "Bitte /reg [PASSWORT] benutzen!");
      }
    }
    return 1;
  }
  return 0;
}
virtualmarc is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 01:34 PM
Command that returns SERVER: Unknown Command. pagie1111 Help Archive 11 11/04/2010 09:55 AM
Server:Unknown Command Justsmile Help Archive 11 20/10/2009 03:33 PM
LVDM Register and Login Unknown command :( Jaybii Server Support 1 11/08/2009 01:30 PM


All times are GMT. The time now is 08:43 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.