GTA-SAN ANDREAS MP

Toto je záhlaví Vašich stránek. Text můžete změnit v administraci v 'Nastavení stránek'.

REGISTER&LOGIN

hore do modu

hned pod
#include <a_samp>

#include <dutils>
#include <dudb>
#include <dini>

do #define

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_SYSTEM 0xEFEFF7AA

medzi new

new PLAYERLIST_authed[MAX_PLAYERS];

hned pod main ale mozete aj medzi new ja to tam mam a ide to]

stock SystemMsg(playerid,msg[]) {
   if ((IsPlayerConnected(playerid))&&(strlen(msg)>0)) {
       SendClientMessage(playerid,COLOR_SYSTEM,msg);
   }
   return 1;
}

stock PlayerName(playerid) {
  new name[255];
  GetPlayerName(playerid, name, 255);
  return name;
}

nad onplayercommandstext

/*
 *  /register password
 *
 */
  dcmd_register(playerid,params[]) {

    // The command shouldn't work if we already are authed
    if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");

    // The command shouldn't work if an account with this
    // kdyz nick uz existuje
    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account already exists, please use '/login password'.");

    // Did he forgot the password?
    if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/register password'");

   // We save the money to the accstate
    if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"Account successfully created. Login with '/login password' now.");
    return true;

 }

 /*
 *  /login password
 *
 */
  dcmd_login(playerid,params[]) {
    if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");
    // kdyz nick neexistuje
    if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'.");

    // kdyz nezada heslo
    if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'");

    if (udb_CheckLogin(PlayerName(playerid),params)) {
       // prikazy provedene pri uspesnem loginu
       GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
       bank[playerid]=dUserINT(PlayerName(playerid)).("banka");
       PLAYERLIST_authed[playerid]=true;

       return SystemMsg(playerid,"Successfully authed!");
    }
    // prihlaseni neuspesne
    return SystemMsg(playerid,"Login failed!");
 }
 


do onplayercommandstext hned na zaciatok

dcmd(login,5,cmdtext); // min zanku 5
  dcmd(register,8,cmdtext); // max znaku 8

do  onplayerdiconnet

 if (PLAYERLIST_authed[playerid]) {
     // data ktery se ulozi kdzy jsi prihlaseny
    dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  }
  PLAYERLIST_authed[playerid]=false;

do onplayerconnect

    PLAYERLIST_authed[playerid]=false;

 a to je vsetko z vlastneho modu ak vyhodi erors hned mi napiste
vzdycky vam vypise toto

Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase

Header size:           3268 bytes
Code size:           205144 bytes
Data size:           101016 bytes
Stack/heap size:      16384 bytes; estimated max. usage=4406 cells (17624 bytes)
Total requirements:  325812 bytes
 
cisla budu vzdy ine tie si nevsimajte

 
Toto je zápatí Vašich stránek. Text můžete změnit v administraci v 'Nastavení stránek'.