Jump to content

Question

Posted

Am facut sistem de pin pe versiunea de MySQL r40 (ultima)

si am probleme:

Cand intru in joc zice pin gresit, daca am linia de forma asta

cache_get_value_name(0, "Pin", PlayerData[playerid][pPin]); 

Daca o am de forma:

cache_get_value_name_int(1, "Pin", PlayerData[playerid][pPin]);

imi ia orice pin, imi poti explica ce trebuie sa fac, in acest caz?

22 answers to this question

Recommended Posts

  • 0
  • Administrator
Posted

Ai verificat mysql.log sa vezi ce erori ai in joc? Si arata-ne sistemul de autentificare sau inregistrare pe care il ai.

  • 0
Posted (edited)
public PlayerLoginDone(playerid)
{
    cache_get_value_name_int(0, "ID", PlayerData[playerid][pID]);
    cache_get_value_name(0, "Name", PlayerData[playerid][pName]);
    cache_get_value_name(0, "Password", PlayerData[playerid][pPassword]);
    cache_get_value_name_int(0, "IP", PlayerData[playerid][pIP]);
    cache_get_value_name(0, "Email", PlayerData[playerid][pEmail]);
    cache_get_value_name_int(0, "Gender", PlayerData[playerid][pGender]);
    cache_get_value_name_int(0, "Age", PlayerData[playerid][pAge]);
    cache_get_value_name_int(0, "RegisterStep", PlayerData[playerid][pRegisterStep]);
    cache_get_value_name_int(0, "Admin", PlayerData[playerid][pAdmin]);
    cache_get_value_name_int(0, "Helper", PlayerData[playerid][pHelper]);
    cache_get_value_name_int(0, "Winner", PlayerData[playerid][pWinner]);
    cache_get_value_name_int(0, "Skin", PlayerData[playerid][pSkin]);
    cache_get_value_name_int(0, "DriversLic", PlayerData[playerid][pDriversLic]);
    cache_get_value_name_int(0, "Money", PlayerData[playerid][pMoney]);
    cache_get_value_name_int(0, "Level", PlayerData[playerid][pLevel]);
 	cache_get_value_name(1, "Pin", PlayerData[playerid][pPin]);
    cache_get_value_name_int(0, "PinSet", PlayerData[playerid][pPinSet]);
   /* new result;
    cache_get_row_count(result,"Pin"); format(PlayerData[playerid][pPin], 5, "%s", result);*/

    if(PlayerData[playerid][pRegisterStep] < 3)
    {
        SetPlayerPos(playerid, 1744.4095, -1809.4142, 54.5687);
        SetPlayerCameraPos(playerid, 1775.1698, -1847.5277, 43.9137);
        SetPlayerCameraLookAt(playerid, 1800.4873, -1867.0626, 13.5706);

        switch(PlayerData[playerid][pRegisterStep])
        {
            case 0: return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "{FFFFFF}E-mail:", "{FFFFFF}Introdu adresa de mail mai jos.\n\nExemplu:[email protected]:", "Ok", "");
            case 1: return ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, "{FFFFFF}Sexul:", "{FFFFFF}Selecteaza-ti ce sex sa aiba caracterul tau:", "Barbat", "Femeie");
            case 2: return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "{FFFFFF}Varsta:", "{FFFFFF}Introdu varsta ta:", "Ok", "");
        }

        return 1;
    }

    SetSpawnInfo(playerid, 0, PlayerData[playerid][pSkin], 1800.1581, -1865.7731, 13.5722, 0, 0, 0, 0, 0, 0, 0), SpawnPlayer(playerid);

   	if(PlayerData[playerid][pAdmin] > 0)
	{
		format(gString, sizeof(gString), "SERVER:{FFFFFF} Te-ai logat cu admin nivel %d.",PlayerData[playerid][pAdmin]);
		SendClientMessage(playerid, COLOR_SERVER,gString);
	}
	
	if(PlayerData[playerid][pHelper] > 0)
	{
		format(gString, sizeof(gString), "SERVER:{FFFFFF} Te-ai logat cu helper nivel %d.",PlayerData[playerid][pHelper]);
		SendClientMessage(playerid, COLOR_SERVER,gString);
	}
	
    if(PlayerData[playerid][pWinner] == 1) SendClientMessage(playerid, COLOR_WHITE, "Your account is upgraded to Winner. ;)");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Anticheat-ul s-a activat cu succes pe contul tau.");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Forumul nostru este: http://www.forum.localhost.ro");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Panelul nostru este: http://www.panel.localhost.ro");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Shopul nostru este: http://www.shop.localhost.ro");
   	if(PlayerData[playerid][pPinSet] == 1) SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Pentru a beneficia de bunurile de pe contul tau foloseste comanda {FFFF4A}[/pin]");
	if(PlayerData[playerid][pPinSet] == 0) SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Nu ai un pin setat. Pentru a-ti seta pinul foloseste comanda {FFFF4A}[/addpin]");

    GetPlayerMoney(playerid);
    GivePlayerMoney(playerid, PlayerData[playerid][pMoney]);
    SetPlayerScore(playerid, PlayerData[playerid][pLevel]);
    return 1;
}

Iti mai arat si restul?

Acum 2 minute, WopsS a spus:

Ai verificat mysql.log sa vezi ce erori ai in joc? Si arata-ne sistemul de autentificare sau inregistrare pe care il ai.

 

Edited by GeOrGe.XD
  • 0
  • Administrator
Posted
6 minutes ago, GeOrGe.XD said:

Iti mai arat si restul?

Da, vreau sa vad si mysql.log.

  • 0
Posted
Acum 1 minut, WopsS a spus:

Da, vreau sa vad si mysql.log.

[18:37:09] [WARNING] mysql_connect: no password specified
[18:37:26] [ERROR] cache_get_value_name: invalid row index '1' (number of rows: '1')

  • 0
Posted (edited)
Acum 21 ore, Maurice a spus:

Incearca


cache_get_value_name_int(0, "Pin", PlayerData[playerid][pPin]); 

 

 

	if(!strcmp(pin, PlayerData[playerid][pPin], true)) {
		PlayerData[playerid][pUnlocked] = 1;
		SCM(playerid, COLOR_YELLOW, "Contul tau a fost deblocat cu succes!");
	} else {
		SCM(playerid, COLOR_YELLOW, "Ai introdus un PIN gresit!");
	}

Se pare ca este de la acel !strcmp, daca il las fara semnul exclamarii ia orice pin.

Edited by GeOrGe.XD
  • 0
Posted (edited)

@GeOrGe.XD

Dupa ce te loghezi pune un print(PlayerData[playerid][pPin]); si zi-mi daca iti incarca in consola PIN-ul din baza de date

PS: Arata-mi dupa cum l-ai pus

Edited by Maurice

Tutoriale despre tot si toate: Tutoriale-Pe.NET

  • 0
Posted
Acum 5 minute, Maurice a spus:

@GeOrGe.XD

Dupa ce te loghezi pune un print(PlayerData[playerid][pPin]); si zi-mi daca iti incarca in consola PIN-ul din baza de date

in consola arata (NULL) face spam cu (NULL)

  • 0
Posted
Acum 6 minute, Maurice a spus:

Asta inseamna ca ori nu afisezi cand trebuie ori nu incarca datele. Astept sa vad cum ai pus print-ul

la ongamemodeint

  • 0
Posted
Acum 5 minute, Maurice a spus:

.........................

Pune-l in functia PlayerLogin si posteaz-o. Zi-mi ce afiseaza

public PlayerLoginDone(playerid)
{
	print(PlayerData[playerid][pPin]);
    cache_get_value_name_int(0, "ID", PlayerData[playerid][pID]);
    cache_get_value_name(0, "Name", PlayerData[playerid][pName]);
    cache_get_value_name(0, "Password", PlayerData[playerid][pPassword]);
    cache_get_value_name_int(0, "IP", PlayerData[playerid][pIP]);
    cache_get_value_name(0, "Email", PlayerData[playerid][pEmail]);
    cache_get_value_name_int(0, "Gender", PlayerData[playerid][pGender]);
    cache_get_value_name_int(0, "Age", PlayerData[playerid][pAge]);
    cache_get_value_name_int(0, "RegisterStep", PlayerData[playerid][pRegisterStep]);
    cache_get_value_name_int(0, "Admin", PlayerData[playerid][pAdmin]);
    cache_get_value_name_int(0, "Helper", PlayerData[playerid][pHelper]);
    cache_get_value_name_int(0, "Winner", PlayerData[playerid][pWinner]);
    cache_get_value_name_int(0, "Skin", PlayerData[playerid][pSkin]);
    cache_get_value_name_int(0, "DriversLic", PlayerData[playerid][pDriversLic]);
    cache_get_value_name_int(0, "Money", PlayerData[playerid][pMoney]);
    cache_get_value_name_int(0, "Level", PlayerData[playerid][pLevel]);
    cache_get_value_name_int(0, "Pin", PlayerData[playerid][pPin]);
    cache_get_value_name_int(0, "PinSet", PlayerData[playerid][pPinSet]);

    if(PlayerData[playerid][pRegisterStep] < 3)
    {
        SetPlayerPos(playerid, 1744.4095, -1809.4142, 54.5687);
        SetPlayerCameraPos(playerid, 1775.1698, -1847.5277, 43.9137);
        SetPlayerCameraLookAt(playerid, 1800.4873, -1867.0626, 13.5706);

        switch(PlayerData[playerid][pRegisterStep])
        {
            case 0: return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "{FFFFFF}E-mail:", "{FFFFFF}Introdu adresa de mail mai jos.\n\nExemplu:[email protected]:", "Ok", "");
            case 1: return ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_MSGBOX, "{FFFFFF}Sexul:", "{FFFFFF}Selecteaza-ti ce sex sa aiba caracterul tau:", "Barbat", "Femeie");
            case 2: return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "{FFFFFF}Varsta:", "{FFFFFF}Introdu varsta ta:", "Ok", "");
        }

        return 1;
    }

    SetSpawnInfo(playerid, 0, PlayerData[playerid][pSkin], 1800.1581, -1865.7731, 13.5722, 0, 0, 0, 0, 0, 0, 0), SpawnPlayer(playerid);

   	if(PlayerData[playerid][pAdmin] > 0)
	{
		format(gString, sizeof(gString), "SERVER:{FFFFFF} Te-ai logat cu admin nivel %d.",PlayerData[playerid][pAdmin]);
		SendClientMessage(playerid, COLOR_SERVER,gString);
	}
	
	if(PlayerData[playerid][pHelper] > 0)
	{
		format(gString, sizeof(gString), "SERVER:{FFFFFF} Te-ai logat cu helper nivel %d.",PlayerData[playerid][pHelper]);
		SendClientMessage(playerid, COLOR_SERVER,gString);
	}
	
    if(PlayerData[playerid][pWinner] == 1) SendClientMessage(playerid, COLOR_WHITE, "Your account is upgraded to Winner. ;)");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Anticheat-ul s-a activat cu succes pe contul tau.");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Forumul nostru este: http://www.forum.localhost.ro");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Panelul nostru este: http://www.panel.localhost.ro");
    SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Shopul nostru este: http://www.shop.localhost.ro");
   	if(PlayerData[playerid][pPinSet] == 1) SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Pentru a beneficia de bunurile de pe contul tau foloseste comanda {FFFF4A}[/pin]");
	if(PlayerData[playerid][pPinSet] == 0) SendClientMessage(playerid, COLOR_SERVER, "SERVER:{FFFFFF} Nu ai un pin setat. Pentru a-ti seta pinul foloseste comanda {FFFF4A}[/addpin]");

    GetPlayerMoney(playerid);
    GivePlayerMoney(playerid, PlayerData[playerid][pMoney]);
    SetPlayerScore(playerid, PlayerData[playerid][pLevel]);
    return 1;
}

La fel "Pin gresit" si in consola nmk

  • 0
Posted
Acum 22 minute, Maurice a spus:

Pune print-ul inainte de return 1 si zi-mi ce zice

In consola nmk, nu warning, nu erori dar in joc la fel, daca vrei iti arat comanda pin sa vezi

  • 0
Posted
CMD:pin(playerid, params[])
{
	new pin[128];
	if(PlayerData[playerid][pUnlocked] != 0) return SCM(playerid, COLOR_YELLOW, "Contul tau este deja deblocat.");
	if(sscanf(params, "s[128]", pin)) return SCM(playerid, COLOR_SERVER, "Sintaxa: /addpin <4-numere>");
	if(strlen(pin) != 4) return SCM(playerid, COLOR_SERVER, "Sintaxa: /pin <4-numere>");
	if(!IsNumeric(pin)) return SCM(playerid, COLOR_SERVER, "Sintaxa: /pin <4-numere>");
	if(!strcmp(pin, PlayerData[playerid][pPin], true)) {
		PlayerData[playerid][pUnlocked] = 1;
		SCM(playerid, COLOR_YELLOW, "Contul tau a fost deblocat cu succes!");
	} else {
		SCM(playerid, COLOR_YELLOW, "Ai introdus un PIN gresit!");
	}
	return 1;
}

 

  • 0
Posted

 

format(string, sizeof(string), "Pinul tau este: %d",PlayerInfo[playerid][pPin]);
SendClientMessage(playerid, COLOR_SERVER, string);

 Pune asta dupa SetPlayerScore si inainte de return 1 si spune-mi in joc ce iti arata

Tutoriale despre tot si toate: Tutoriale-Pe.NET

  • 0
Posted (edited)
Acum 49 minute, Maurice a spus:

 


format(string, sizeof(string), "Pinul tau este: %d",PlayerInfo[playerid][pPin]);
SendClientMessage(playerid, COLOR_SERVER, string);

 Pune asta dupa SetPlayerScore si inainte de return 1 si spune-mi in joc ce iti arata

arata pinul ca in baza de date

In baza de date coloana este facuta astfel: `Pin` varchar(4) NOT NULL,

Imi arata pinul ca in baza de date, am facut o chiestie: mi am setat pin 0 si am dat pe svr addpin dupa am dat pin, imi zice ca codul este bun si dupa relog codul zice ca este gresit

Edited by GeOrGe.XD
  • 0
Posted (edited)
Acum 16 minute, Maurice a spus:

Modifica in baza de date campul "Pin" din varchar in int

Acelasi text in game apare...

Eu zic ca de la asta este devine

if(!strcmp(pin, PlayerData[playerid][pPin], true)) {

dar daca pun if(strcmp, pin, bla bla) imi ia orice pin

Edited by GeOrGe.XD
  • 0
Posted

@Maurice, mersii oricum de ajutor, dar am rezolvat singur.

Trebuia sa fac asa:

    PlayerData[playerid][pPin] = cache_get_value_name(0, "Pin", gString);
    format(PlayerData[playerid][pPin], 5, gString);

Oricum iti multumesc.

  • 0
Posted
25 minutes ago, GeOrGe.XD said:

@Maurice, mersii oricum de ajutor, dar am rezolvat singur.

Trebuia sa fac asa:

    PlayerData[playerid][pPin] = cache_get_value_name(0, "Pin", gString);
    format(PlayerData[playerid][pPin], 5, gString);

Oricum iti multumesc.

Da, dar daca faceai totul pe int.. si verificarea si tot, iti era mai usor.

Oricum, conteaza ca ai rezolvat in final.

Tutoriale despre tot si toate: Tutoriale-Pe.NET

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.