Please i need an script
#1

I need an script with working /register [pass] . /login [pass] , and that will create something in the account , like pMoney or something . I havd tryed bud i did not succed , i was even tinking about taking the GF and dellete everything else , after serveral unssucefully attemps of creating my own .
I had tried this one http://forum.sa-mp.com/index.php?topic=77756.0 , but i did not succed.

PLEASE HELP .
Reply
#2

Save this and compile it to get .amx and use it.

pawn Код:
//***************************SCRIPT BY Cloud9********************************//
#include <a_samp>
#include <dudb>
#include <dutils>
#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

//Colors//
#define COLOR 0xEFEFF7AA
#define green 0x33FF33AA
#define blue 0x00FFFFAA

new PLAYERLIST_aut[MAX_PLAYERS];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Register / Login System");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print("Register / Login System");
    print("----------------------------------\n");
}

#endif

public OnPlayerRequestSpawn(playerid)
{
if (udb_Exists(PlayerName(playerid))){
if (!PLAYERLIST_aut[playerid]){
SendClientMessage(playerid,green,"You have already registered, use /login to log into your account.");
return 0;
}
}
return 1;
}

public OnPlayerDisconnect(playerid) {
 if (PLAYERLIST_aut[playerid]) {
   // If someone has logged in, it saves money and score.
  dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
  dUserSetINT(PlayerName(playerid)).("score",GetPlayerScore(playerid));
 }
 PLAYERLIST_aut[playerid] =false;
 return 1;
}

public OnPlayerConnect(playerid)
{

    if (PLAYERLIST_aut[playerid]==0){
if (udb_Exists(PlayerName(playerid))){
SystemMsg(playerid,"You have already registered, please /login [password] to login.");
}
else{ SystemMsg(playerid,"You do not have an account, use /register [password] to register then /login [password] to login.");
}

return 0;
}
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
 dcmd(login,5,cmdtext);
 dcmd(register,8,cmdtext);
 return 0;
}

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

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

 dcmd_register(playerid,params[]) {

  if (PLAYERLIST_aut[playerid]) return SystemMsg(playerid,"You have already had an account.");
  if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"You have already created an account, /login [password] to login.");
  if (strlen(params)==0) return SystemMsg(playerid,"USAGE: /register [password]");
  if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"You have successfully created your account, now use /login [password] to login.");
  return true;

 }

 dcmd_login(playerid,params[]) {

  if (PLAYERLIST_aut[playerid]) return SystemMsg(playerid,"You have already logined.");
  if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"You do not have an account, please /register [password]");
  if (strlen(params)==0) return SystemMsg(playerid,"USAGE: /login [password]");
  if (udb_CheckLogin(PlayerName(playerid),params)) {
    SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score"));
      SetPlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money"));
    PLAYERLIST_aut[playerid]=true;
    return SystemMsg(playerid,"You have successfully logined.");
  }
  return SystemMsg(playerid,"Wrong password or nickname!");
}
Reply
#3

That's good , buy i don't undestand what's in it , so i cannot modify it.

I succed to make something , but how do i make OnPlayerUpdate , and OnPlayerLogin , to give the variabiles the valours from .ini account ?

I need someting like PlayerInfo[playerid][AdminLevel] .

I will realy apreciate if anyone help me .

So far i tryed
Код:
 if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][AdminLevel] = strval( val );}
But it doesn't work .
Reply
#4

UP , please help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)