Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-01-15, 21:58


PvF.GreeN







Wiek: 28
Na forum: 4672 dni
Posty: 209
Nick w MP: NexuS

Piwa: 2875

Respekt: 128
Respekt: 128

Ostrzeżeń: 60%
Cze?? mam taki problem. O tu? zrobi?em system admina i vip pod mysql..Ale musi by? co? ?le bo na vipa loguje mnie co chwile..Chocia? nie mam w bazie go dopisanego ;( A admina mam do pisanego, a wcale nie loguje..

Kod na logowanie vip'a

Kod:

new vips = mysql_PlayerGetInt(lname, "ifnull(datediff(vip,now()),'-5')");
Vip[playerid] = (vips>=0) ? (true): (false);
if( Vip[playerid] == false ) {
Vips_Online++;
SCM(playerid, 0x33FF99FF, "Zosta?e? automatycznie zalogowany jako VIP.");
}


odczyt admina z mysql

Kod:

AdministratorLevel[playerid] = mysql_PlayerGetInt(lname, "admin");


cmd /alogin

Kod:

CMD:alogin(playerid, cmdtext[])
{
new ahaslo[22],
string2[330];
GetPlayerName(playerid, pName[playerid], MAX_PLAYER_NAME);
if(sscanf(cmdtext, "s[20]", ahaslo)) return SCM(playerid, -1, "{cbb668}/alogin {FF8811}<has?o>");

if(Administrator[playerid] > 0) return SCM(playerid, -1, "{cbb668}Ju? jeste? zalogowany jako {FF8811}Administrator!");
if(!Administrator[playerid]) return SCM(playerid, -1, "{cbb668}Nie ma ci? na li?cie {FF8811}administrator?w!");
if(strcmp(ahaslo, ADMIN_PASSWORD, false) !=0) return SCM(playerid, -1, "{cbb668}Nieprawid?owe {FF8811}has?o.");

Administrator[playerid] = AdministratorLevel[playerid];
Admins_Online++;
SoundForAll(1133);
format(string2, sizeof(string2), "{FF8811}%s {cbb668}zalogowa?(a) si? jako administrator poziom: {FF8811}%d", pName[playerid], AdministratorLevel[playerid]);
SendClientMessageToAll(0xE10000FF, string2);
return 1;
}


Z g?ry dzi?ki i za pomoc :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 13:52


mrx3667

mrdrifter






Wiek: 29
Na forum: 4533 dni
Posty: 143
Nick w MP: mrdrifter

Piwa: 359

Respekt: 377,8
Respekt: 377,8Respekt: 377,8Respekt: 377,8Respekt: 377,8

pokaz funkcje mysql_PlayerGetInt oraz printuj co zwraca.

Podpis







GG: 3097129
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 13:56


PvF.GreeN







Wiek: 28
Na forum: 4672 dni
Posty: 209
Nick w MP: NexuS

Piwa: 2875

Respekt: 128
Respekt: 128

Ostrzeżeń: 60%
mrx3667,

Kod:


//code by mrdrifter
stock mysql_PlayerGetInt(player[], key[]) {
new tmpres;

new nick[30], string2[123];
mysql_real_escape_string(player, nick);

format(string2, sizeof(string2), "select %s from players where nick='%s'", key, nick);
mysql_query(string2);

mysql_store_result();
if(!mysql_num_rows())
{
mysql_free_result();
return 0;
}
tmpres = mysql_fetch_int();
mysql_free_result();

return tmpres;
}
stock mysql_PlayerGet(player[], key[]) {
new tmpres[DINI_MAX_STRING];
new nick[30];

mysql_real_escape_string(player, nick);

format(string2, sizeof(string2), "select %s from Gracze where nick='%s'", key, nick);
mysql_query(string2);
mysql_store_result();
if(!mysql_num_rows())
{
mysql_free_result();
format(tmpres, 20, "Brak");
return tmpres;
}

mysql_fetch_string(tmpres);
mysql_free_result();


return tmpres;
}


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 13:58


mrx3667

mrdrifter






Wiek: 29
Na forum: 4533 dni
Posty: 143
Nick w MP: mrdrifter

Piwa: 359

Respekt: 377,8
Respekt: 377,8Respekt: 377,8Respekt: 377,8Respekt: 377,8

nie masz zadnych bledow mysql w konsoli?

new vips = mysql_PlayerGetInt(lname, "ifnull(datediff(vip,now()),'-5')");

daj
new vips = mysql_PlayerGetInt(lname, "ifnull(datediff(vip,now()),'-5')");
printf("vip active %d day", vips);

Podpis







GG: 3097129
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:00


PvF.GreeN







Wiek: 28
Na forum: 4672 dni
Posty: 209
Nick w MP: NexuS

Piwa: 2875

Respekt: 128
Respekt: 128

Ostrzeżeń: 60%
W?a?nie mam du?o b?ed?w w konsoli zwi?zanych z mysql :c Ale nie wiem o co chodzi , wszystko dzia?a?o okey. Wi?c nie pr?bowa?em naprawi?, a teraz mam konsekwencje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:04


mrx3667

mrdrifter






Wiek: 29
Na forum: 4533 dni
Posty: 143
Nick w MP: mrdrifter

Piwa: 359

Respekt: 377,8
Respekt: 377,8Respekt: 377,8Respekt: 377,8Respekt: 377,8

Skoro masz bledy w konsoli do zrob tak: http://pastebin.com/9Pmqhs36 w konsoli bedziesz mial zapytanie wklej je do phpmyadmina i pokaz blad...

Podpis







GG: 3097129
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:07


PvF.GreeN







Wiek: 28
Na forum: 4672 dni
Posty: 209
Nick w MP: NexuS

Piwa: 2875

Respekt: 128
Respekt: 128

Ostrzeżeń: 60%
mrx3667, w konsoli pokaza?o si? co? takiego.

Kod:

[14:06] query: select (admin) dupa from players where nick='NULL'
[14:06] query: select (ifnull(datediff(vip,now()),'-5')) dupa from players where nick='NULL'
[14:06] [MySQL] Error (0): Failed to exeute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weapon` WHERE `nick` = 'eG.NexuS_aK'' at line 1.
[14:06] [MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weapon` WHERE `nick` = 'eG.NexuS_aK'' at line 1.
[14:06] [MySQL] Error (0): Function: mysql_num_rows called when no result stored. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'weapon` WHERE `nick` = 'eG.NexuS_aK'' at line 1.
[14:06] [MySQL] Error (0): Failed to exeute query. Duplicate entry 'eG.NexuS_aK' for key 'nick'.


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:12


mrx3667

mrdrifter






Wiek: 29
Na forum: 4533 dni
Posty: 143
Nick w MP: mrdrifter

Piwa: 359

Respekt: 377,8
Respekt: 377,8Respekt: 377,8Respekt: 377,8Respekt: 377,8

"nick='NULL' "

masz nick NULL? nie sadzem...

[ Dodano: 2014-01-16, 14:15 ]
Dodaj GetPlayerName(playerid, lname, sizeof(lname)); przed new vips = mysql_PlayerGetInt(lname, "ifnull(datediff(vip,now()),'-5')");

Podpis







GG: 3097129
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:18


PvF.GreeN







Wiek: 28
Na forum: 4672 dni
Posty: 209
Nick w MP: NexuS

Piwa: 2875

Respekt: 128
Respekt: 128

Ostrzeżeń: 60%
mrx3667, Wielkie dzi?i nie daje ju? vip'a. Ale pokazuj? si? info Zosta?e? zalogowany automatycznie na konto VIP..

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:41


mrx3667

mrdrifter






Wiek: 29
Na forum: 4533 dni
Posty: 143
Nick w MP: mrdrifter

Piwa: 359

Respekt: 377,8
Respekt: 377,8Respekt: 377,8Respekt: 377,8Respekt: 377,8

Pawn


new vips mysql_PlayerGetInt(lname"ifnull(datediff(vip,now()),'-5')");
if( vips >= ) {
    Vips_Online++;
    Vip[playerid] = true;
    SCM(playerid0x33FF99FF"Zosta?e? automatycznie zalogowany jako VIP.");
}


Podpis







GG: 3097129
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-01-16, 14:46


PvF.GreeN







Wiek: 28
Na forum: 4672 dni
Posty: 209
Nick w MP: NexuS

Piwa: 2875

Respekt: 128
Respekt: 128

Ostrzeżeń: 60%
Wszystko dzia?a ! Wielkie dzi?ki zi?. Do zamkni?cia!

Postaw piwo autorowi tego posta
 

 
Tagi: system :: vipa :: admina
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » PAWN » [INNE] System Vip'a i Admina Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku