[FilterScript]Register/Login v1.0

Započeo BalkaNation, Septembar 20, 2013, 21:38:50 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Hahahahha pa nema niti jedan varnig ja koristim taj login i hvala ti mnogo pravim polako svoj SVAKA CAST

E ali kada ja stavim sve lijepo to unutra tu filterskriptu i onda u server.cfg onda se mi sve lijepo pojavi ali kada se hocu reg/log onda mi se pojavi ovo < > spawn i onda mi se server ugasi sto je tu problem sto treba napraviti?

U filterskripti ti mora biti:


public OnDialogResponse(funkcije...) {
     if(dialogid == nekidialog) {
          return 1; }
     return 1; }


A  ugamemodu:


public OnDialogResponse(funkcije...) {
     if(dialogid == nekidialog) {
          return 1; }
     return 0; }


Ovo mora biti u FS i u GM?

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
        //--------------------------------------------------------------------------
        if(dialogid == REGISTER_DIALOG) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer nisi prihvatio pravila igre !"); SetPVarInt(playerid, "needkick", 1); return 1; }
                ShowPlayerDialog(playerid, REGISTER_DIALOG2, DIALOG_STYLE_INPUT, "Registracija", "Molimo te da upises lozinku.\n\nLozinku nemoj zaboraviti jer bez\nnje neces moci pristupiti svom racunu !", "Dalje", "Odustani");
                return 1; }
        //--------------------------------------------------------------------------
        if(dialogid == REGISTER_DIALOG2) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer si odustao od registracije !"); SetPVarInt(playerid, "needkick", 1); return 1; }
                new str[256];
                if(strlen(inputtext) < MIN_PASS || strlen(inputtext) > MAX_PASS) {
                        format(str, sizeof(str), "Lozinka mora imati najmanje %d znakova a najviÅ¡e %d znakova !\n\nMolimo te da ponovno upises loziku !", MIN_PASS, MAX_PASS);
                        ShowPlayerDialog(playerid, REGISTER_DIALOG2, DIALOG_STYLE_INPUT, "Registracija", str, "Dalje", "Odustani");
                        return 1; }
                SetPVarInt(playerid, "regpass", udb_hash(inputtext));
                ShowPlayerDialog(playerid, REGISTER_DIALOG3, DIALOG_STYLE_INPUT, "Registracija", "Ponovi lozinku kako bi je potvrdio !", "Dalje", "Odustani");
                return 1; }
        //--------------------------------------------------------------------------
        if(dialogid == REGISTER_DIALOG3) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer si odustao od registracije !"); SetPVarInt(playerid, "needkick", 1); return 1; }
        new str[128];
                if(strlen(inputtext) < MIN_PASS || strlen(inputtext) > MAX_PASS) {
                        format(str, sizeof(str), "Lozinka mora imati najmanje %d znakova a najviÅ¡e %d znakova !\n\nMolimo te da ponovno upises loziku !", MIN_PASS, MAX_PASS);
                        ShowPlayerDialog(playerid, REGISTER_DIALOG3, DIALOG_STYLE_INPUT, "Registracija", str, "Dalje", "Odustani");
                        return 1; }
                if(udb_hash(inputtext) != GetPVarInt(playerid, "regpass")) return ShowPlayerDialog(playerid, REGISTER_DIALOG3, DIALOG_STYLE_INPUT, "Registracija", "Upisana lozinka se ne slaže sa prethodno upisanom lozinkom !", "Dalje", "Odustani");
ili ovo?

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
        //--------------------------------------------------------------------------
        if(dialogid == REGISTER_DIALOG) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer nisi prihvatio pravila igre !"); SetPVarInt(playerid, "needkick", 1); return 1; }
                ShowPlayerDialog(playerid, REGISTER_DIALOG2, DIALOG_STYLE_INPUT, "Registracija", "Molimo te da upises lozinku.\n\nLozinku nemoj zaboraviti jer bez\nnje neces moci pristupiti svom racunu !", "Dalje", "Odustani");
                return 1; }
        //--------------------------------------------------------------------------
        if(dialogid == REGISTER_DIALOG2) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer si odustao od registracije !"); SetPVarInt(playerid, "needkick", 1); return 1; }
                new str[256];
                if(strlen(inputtext) < MIN_PASS || strlen(inputtext) > MAX_PASS) {
                        format(str, sizeof(str), "Lozinka mora imati najmanje %d znakova a najviÅ¡e %d znakova !\n\nMolimo te da ponovno upises loziku !", MIN_PASS, MAX_PASS);
                        ShowPlayerDialog(playerid, REGISTER_DIALOG2, DIALOG_STYLE_INPUT, "Registracija", str, "Dalje", "Odustani");
                        return 1; }
                SetPVarInt(playerid, "regpass", udb_hash(inputtext));
                ShowPlayerDialog(playerid, REGISTER_DIALOG3, DIALOG_STYLE_INPUT, "Registracija", "Ponovi lozinku kako bi je potvrdio !", "Dalje", "Odustani");
                return 1; }
        //--------------------------------------------------------------------------
        if(dialogid == REGISTER_DIALOG3) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer si odustao od registracije !"); SetPVarInt(playerid, "needkick", 1); return 1; }
        new str[128];
                if(strlen(inputtext) < MIN_PASS || strlen(inputtext) > MAX_PASS) {
                        format(str, sizeof(str), "Lozinka mora imati najmanje %d znakova a najviÅ¡e %d znakova !\n\nMolimo te da ponovno upises loziku !", MIN_PASS, MAX_PASS);
                        ShowPlayerDialog(playerid, REGISTER_DIALOG3, DIALOG_STYLE_INPUT, "Registracija", str, "Dalje", "Odustani");
                        return 1; }
                if(udb_hash(inputtext) != GetPVarInt(playerid, "regpass")) return ShowPlayerDialog(playerid, REGISTER_DIALOG3, DIALOG_STYLE_INPUT, "Registracija", "Upisana lozinka se ne slaže sa prethodno upisanom lozinkom !", "Dalje", "Odustani");
                //----------------------------------------------------------------------
                new str2[64];
                format(str2, sizeof(str2), "/Users/%s.ini", pName(playerid));
                //Statistika
                dini_Create(str2);
                dini_IntSet(str2, "firstspawn", 1);
                dini_IntSet(str2, "lozinka", udb_hash(inputtext));
        dini_IntSet(str2, "money", GET_MONEY_COMMAND(playerid));
        dini_IntSet(str2, "score", GET_SCORE_COMMAND(playerid));
            dini_FloatSet(str2, "posx", StartPos[posx]);
            dini_FloatSet(str2, "posy", StartPos[posy]);
            dini_FloatSet(str2, "posz", StartPos[posz]);
            dini_FloatSet(str2, "posa", StartPos[posa]);
            dini_IntSet(str2, "inteiror", StartPos[interior]);
        dini_IntSet(str2, "vw", StartPos[vw]);
                //----------------------------------------------------------------------
                new str3[128], dan, mje, god, sat, minu, sec;
                gettime(sat, minu, sec); getdate(dan, mje, god);
                ClearText(playerid);
                SendClientMessage(playerid, -1, ""loginboja"________________________________________________________");
        SendClientMessage(playerid, -1, ""loginboja"SERVER"textboja": UspjeÅ¡no si se registrirao !");
                format(str3, sizeof(str3), ""loginboja"DATUM"textboja": %d.%d.%d", dan, mje, god); SendClientMessage(playerid, -1, str3);
        format(str3, sizeof(str3), ""loginboja"VRIJEME"textboja": %d:%d:%d", sat, minu, sec); SendClientMessage(playerid, -1, str3);
                format(str3, sizeof(str3), ""loginboja"INFO"textboja": %s dobrodosao na %s !", pName(playerid), SERVER_NAME); SendClientMessage(playerid, -1, str3);
                SendClientMessage(playerid, -1, ""loginboja"________________________________________________________");
                SetPVarInt(playerid, IS_LOGGED_VAR, 1);
                LoginPlayer(playerid);
                return 1; }
        //--------------------------------------------------------------------------
        if(dialogid == LOGIN_DIALOG) {
            if(!response) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer si odustao od logiranja !"); SetPVarInt(playerid, "needkick", 1); return 1; }
                new str[64];
                format(str, sizeof(str), "/Users/%s.ini", pName(playerid));
                //----------------------------------------------------------------------
                if(udb_hash(inputtext) != dini_Int(str, "lozinka")) {
                        SetPVarInt(playerid, "wrongpass", GetPVarInt(playerid, "wrongpass")+1);
                        if(GetPVarInt(playerid, "wrongpass") >= MAX_WRONG_PASS) { SendClientMessage(playerid, kickboja, "KICK"textboja": Kickan si sa servera jer si previÅ¡e puta pogrijeÅ¡io lozinku !"); SetPVarInt(playerid, "needkick", 1); return 1; }
                        new str2[256];
                        format(str2, sizeof(str2), "Error: PogrijeÅ¡io si lozinku !\n\nPokuÅ¡aj: %d/%d\n\nMolimo te upisi valjanu lozinku !", GetPVarInt(playerid, "wrongpass"), MAX_WRONG_PASS);
                        ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "Logiranje", str2, "Logiraj se", "Odustani");
                    return 1; }
                //----------------------------------------------------------------------
                new str3[128], dan, mje, god, sat, minu, sec;
                gettime(sat, minu, sec); getdate(dan, mje, god);
                ClearText(playerid);
                SendClientMessage(playerid, -1, ""loginboja"________________________________________________________");
        SendClientMessage(playerid, -1, ""loginboja"SERVER"textboja": UspjeÅ¡no si se logirao !");
                format(str3, sizeof(str3), ""loginboja"DATUM"textboja": %d.%d.%d", dan, mje, god); SendClientMessage(playerid, -1, str3);
        format(str3, sizeof(str3), ""loginboja"VRIJEME"textboja": %d:%d:%d", sat, minu, sec); SendClientMessage(playerid, -1, str3);
                format(str3, sizeof(str3), ""loginboja"INFO"textboja": %s dobrodosao natrag na %s !", pName(playerid), SERVER_NAME); SendClientMessage(playerid, -1, str3);
                SendClientMessage(playerid, -1, ""loginboja"________________________________________________________");
                SetPVarInt(playerid, IS_LOGGED_VAR, 1);
                LoginPlayer(playerid);
                return 1; }
        //--------------------------------------------------------------------------
        return 1; }

Citat: Matorp poslato Oktobar 29, 2013, 21:03:34 POSLE PODNE
Ovo mora biti u FS i u GM?


Ne razumijem te sta si s tome gore htjeo reci ali ovako...

OnDialogResponse zove ti se kada igrac klikne nesto na dialogu. Prvo ti se to traži u gamemodu onda u filterskripti.

Ako ti OnDialogResponse završava u gamemodu na return 1 neče ti tražiti po filterskriptama, ako ti završava na 0 tražiti će i po filterskriptama.

Ali ako naÄ'e odreÄ'eni dialog onda stavis reutrn 1 kao znak da je pronaslo te da dalje ne trazi po drugim filterskriptama.

Znaci ljepo stavis zadnji return 0 u gamemodu po OnDialogResponse...


Nece mi neznam sto je ja ti dam cijeli gm pa ti prvojeri PLS

//includes
#include <a_samp>
#include <zcmd>
#include <sscanf2>
//if defined
#if defined FILTERSCRIPT
//defines
#define SCRIPT_VERSION "v1.0"
#define LAST_UPDATE "26.10.2013"
#define SCRIPT_BY "Orion Mark"
#define ProxDetector
#define SCM SendClientMessage
//Boje
#define BELA            "{FFFFFF}"
#define ZELENA          "{6EF83C}"
#define CRVENA          "{F81414}"
#define ZUTA            "{F3FF02}"
#define ORANGE          "{FFAF00}"
#define SPLAVA          "{F77205}"
#define ZPLAVA          "{22C7F5}"
#define PLAVA           "{0049FF}"
#define ROZA            "{FF00EA}"
#define CMDC            "{B8FF02}"
#define SERVER          "{AFE7FF}"
#define SZELENA         "{C9FFAB}"
#define LJUB            "{EE11EE}"
#define SIVA            "{C0C0C0}"
#define CRVENA2         "{FF6347}"
#define PPLAVA          "{0084e3}"
#define SCRV2           "{FF6347}"
#define BALLASC         "{D1345B}"
#define HZELENA         "{04CC29}"
#define GROVE           0x00D900C8
#define AZUTA           0xFFC801C8
#define BELA2           0xFFFFFFAA
#define PROX            0xC2A2DAAA
#define SCRVENA         0xFF6347AA
#define GRAD2 0xBFC0C2FF
#define GRAD3           0x6A696AFF
#define SVETLOPLAVA 0x33CCFFAA
////////////////////////////////////////////////////////////////////////////////
public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print("     Orion Mark RolePlay v2.0       ");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
SetGameModeText("OrionMark");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}

public OnRconCommand(cmd[])
{
return 1;
}

public OnPlayerRequestSpawn(playerid)
{
return 1;
}

public OnObjectMoved(objectid)
{
return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}

public OnPlayerExitedMenu(playerid)
{
return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}

public OnPlayerUpdate(playerid)
{
return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
return 0;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
/////////////////////////////komande////////////////////////////////////////////
CMD:setskin(playerid, params[])
{
new ID,skinid,ime[MAX_PLAYER_NAME],ime1[MAX_PLAYER_NAME],s[68],s1[68];
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xC2A2DAAA, "Niste ovlasteni");
if (sscanf(params, "ud", ID,skinid)) SendClientMessage(playerid, 0xC2A2DAAA, "Komanda: /setskin [IgracevID/DeoImena] [ID skina]");
if (ID == INVALID_PLAYER_ID)  return SendClientMessage(playerid, 0xAA3333AA,  "[Greska]: Taj igrac je Offline !");
GetPlayerName(playerid, ime, sizeof(ime));
GetPlayerName(ID, ime1, sizeof(ime1));
format(s, sizeof(s), "%s vam je promenio skin", ime);
format(s1, sizeof(s1), "Promenili ste skin %s-u", ime1);
SendClientMessage(ID, 0xC2A2DAAA, s);
SendClientMessage(playerid, 0xC2A2DAAA, s1);
SetPlayerSkin(ID, skinid);
return true;
}
////////////////////////////////////////////////////////////////////////////////
CMD:zivot(playerid, params[])
{
SetPlayerHealth(playerid, 99);
SendClientMessage(playerid, 0xFFFFFF, "Napunili ste si zivot");
return 1;
}
////////////////////////////////////////////////////////////////////////////////
CMD:novac(playerid, params[])
{
GivePlayerMoney(playerid, 1000);
SendClientMessage(playerid, 0x33CCFFAA, "igracu si dao 1000$");
return 1;
}