20.02.2014, 11:40
login part
and thread_prijava on OnQueryFinish
pawn Код:
if(dialogid == 1)
{
if(response)
{
if(strlen(inputtext) < MIN_DUZINA_LOZINKE || strlen(inputtext) > MAX_DUZINA_LOZINKE)
{
new LozinkaString[128];
format(LozinkaString,sizeof LozinkaString,"*G-Unit: Lozinka ne smije biti manja od %d,a veca od %d!",MIN_DUZINA_LOZINKE,MAX_DUZINA_LOZINKE);
SendClientMessage(playerid,0xDB023EFF,LozinkaString);
new name[MAX_PLAYER_NAME],loginstring[512];
GetPlayerName(playerid,name,sizeof(name));
format(loginstring,sizeof(loginstring),"{00C0FF}_____________________________________\n\n{FFFFFF}Dobrodošao na G-Unit RolePlay/Dm Server! {00C0FF}\n\n%s\n{FFFFFF}Vas je korisnicki racun pronadjen!\n\nMolimo upisi lozinku da udjes na server:\n{00C0FF}_______________________________________",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{FFFFFF}Prijava",loginstring,"Logiraj","Izlaz");
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,PlayerInfo[playerid][Lozinka],false))
{
new query[300],imex[MAX_PLAYER_NAME];
ImeIgraca(playerid,imex);
format(query,sizeof query,"SELECT `ID` FROM `users` WHERE `Nick` = '%s' AND `Lozinka` = '%s'",imex,hashpass);
print(hashpass);
mysql_query(query,THREAD_PRIJAVA,playerid);
mysql_store_result();
mysql_free_result();
}
else
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
new loginstring[512];
format(loginstring,sizeof(loginstring),"{00C0FF}________________________________{F81414}\n[Greska] Unijeli ste kratku ili netocnu lozinku\n\n{FFFFFF}Vas je racun pronadjen!\n{00C0FF}%s\n\n{FFFFFF}Molimo upisite vasu lozinku:\n{00C0FF}_____________________________________",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{FFFFFF}Prijava",loginstring,"Logiraj","Izlaz");
hPokusajiLogiranja[playerid]++;
if(hPokusajiLogiranja[playerid] >= MAX_POKUSAJA_LOGIRANJA)
{
SCM(playerid,0xDB023EFF,"G-Protect: Unijeli ste 3 puta netocnu lozinku! Vasa ip adresa je banana!");
KickWithMessage(playerid);
h_Ban(playerid);
}
}
}
}
pawn Код:
case THREAD_PRIJAVA:
{
mysql_store_result();
if(mysql_num_rows() == 0) return SCM(extraid,SIVA, "Greska pri ucitavanju accounta, pokusajte ponovo..."), Kick(extraid), mysql_free_result();
new linija[3096];
mysql_fetch_row(linija);
mysql_free_result();
ProcitajLiniju(extraid,linija);
if(GetPVarInt(extraid,"PrviSpawn"))
{
if(PlayerInfo[extraid][Registriran] == 1)
{
hIgracevAccountPostoji[extraid] = 1;
SetSpawnInfo(extraid,0,PlayerInfo[playerid][Skin],1732.0470,-1911.8047,13.5624,1.0,-1,-1,-1,-1,-1,-1);
SetPlayerSpawn(extraid);
new tmp2[256],string2[256],month,day,mtext[20],year,playername2[MAX_PLAYER_NAME],ime[MAX_PLAYER_NAME];
RPIme(extraid,ime);
GetPlayerName(extraid,playername2,sizeof(playername2));
getdate(year,month,day);
if(month == 1) { mtext = "Siječanj.2013"; }
else if(month == 2) { mtext = "Veljača.2013"; }
else if(month == 3) { mtext = "Ozujak.2013"; }
else if(month == 4) { mtext = "Travanj.2013"; }
else if(month == 5) { mtext = "Svibanj.2013"; }
else if(month == 6) { mtext = "Lipanj.2013"; }
else if(month == 7) { mtext = "Srpanj.2013"; }
else if(month == 8) { mtext = "Kolovoz.2013"; }
else if(month == 9) { mtext = "Rujan.2013"; }
else if(month == 10) { mtext = "Listopad.2013"; }
else if(month == 11) { mtext = "Studeni.2013"; }
else if(month == 12) { mtext = "Prosinac.2013"; }
new hour,minuite,second;
gettime(hour,minuite,second);
FixHour(hour);
hour = shifthour;
if(PlayerInfo[extraid][Level] == -999)
{
Ban(extraid);
}
new hIme[MAX_PLAYER_NAME];
RPIme(extraid,hIme);
new Izbacen = 0;
if(PlayerInfo[extraid][Clan] > 0 && PlayerInfo[extraid][Lider] == 0)
{
if(PlayerInfo[extraid][Clan] == 1 && strcmp(PDInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 2 && strcmp(FBIInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 3 && strcmp(LSBInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 4 && strcmp(MDInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 5 && strcmp(MS13Info[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 6 && strcmp(TSCInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 8 && strcmp(GSFInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 9 && strcmp(CNNInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 10 && strcmp(TaxiInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 11 && strcmp(HInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 12 && strcmp(YInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 13 && strcmp(URInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 14 && strcmp(RMInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 15 && strcmp(LCNInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 16 && strcmp(SWATInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Clan] == 17 && strcmp(LSVInfo[PlayerInfo[extraid][MjestoUOrg]][Mjesto],hIme,false)) Izbacen = 1;
if(PlayerInfo[extraid][MjestoUOrg] < 1 || PlayerInfo[extraid][MjestoUOrg] > 20) Izbacen = 1;
}
if(PlayerInfo[extraid][Lider] > 0)
{
if(PlayerInfo[extraid][Lider] == 1 && strcmp(PDInfo[1][Lider],hIme,false) && strcmp(PDInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 2 && strcmp(FBIInfo[1][Lider],hIme,false) && strcmp(FBIInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 3 && strcmp(LSBInfo[1][Lider],hIme,false) && strcmp(LSBInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 4 && strcmp(MDInfo[1][Lider],hIme,false) && strcmp(MDInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 5 && strcmp(MS13Info[1][Lider],hIme,false) && strcmp(MS13Info[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 6 && strcmp(TSCInfo[1][Lider],hIme,false) && strcmp(TSCInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 8 && strcmp(GSFInfo[1][Lider],hIme,false) && strcmp(GSFInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 9 && strcmp(CNNInfo[1][Lider],hIme,false) && strcmp(CNNInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 10 && strcmp(TaxiInfo[1][Lider],hIme,false) && strcmp(TaxiInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 11 && strcmp(HInfo[1][Lider],hIme,false) && strcmp(HInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 12 && strcmp(YInfo[1][Lider],hIme,false) && strcmp(YInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 13 && strcmp(URInfo[1][Lider],hIme,false) && strcmp(URInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 14 && strcmp(RMInfo[1][Lider],hIme,false) && strcmp(RMInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 15 && strcmp(LCNInfo[1][Lider],hIme,false) && strcmp(LCNInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 16 && strcmp(SWATInfo[1][Lider],hIme,false) && strcmp(SWATInfo[2][Lider],hIme,false)) Izbacen = 1;
else if(PlayerInfo[extraid][Lider] == 17 && strcmp(LSVInfo[1][Lider],hIme,false) && strcmp(LSVInfo[2][Lider],hIme,false)) Izbacen = 1;
if(Izbacen == 0)
{
if(PlayerInfo[extraid][Lider] == 1) PlayerInfo[extraid][Skin] = 283;
else if(PlayerInfo[extraid][Lider] == 2) PlayerInfo[extraid][Skin] = 165;
else if(PlayerInfo[extraid][Lider] == 3) PlayerInfo[extraid][Skin] = 104;
else if(PlayerInfo[extraid][Lider] == 4) PlayerInfo[extraid][Skin] = 57;
else if(PlayerInfo[extraid][Lider] == 5) PlayerInfo[extraid][Skin] = 186;
else if(PlayerInfo[extraid][Lider] == 6) PlayerInfo[extraid][Skin] = 115;
else if(PlayerInfo[extraid][Lider] == 8) PlayerInfo[extraid][Skin] = 271;
else if(PlayerInfo[extraid][Lider] == 9) PlayerInfo[extraid][Skin] = 227;
else if(PlayerInfo[extraid][Lider] == 10) PlayerInfo[extraid][Skin] = 61;
else if(PlayerInfo[extraid][Lider] == 11) PlayerInfo[extraid][Skin] = 186;
else if(PlayerInfo[extraid][Lider] == 12) PlayerInfo[extraid][Skin] = 120;
else if(PlayerInfo[extraid][Lider] == 13) PlayerInfo[extraid][Skin] = 217;
else if(PlayerInfo[extraid][Lider] == 14) PlayerInfo[extraid][Skin] = 113;
else if(PlayerInfo[extraid][Lider] == 15) PlayerInfo[extraid][Skin] = 113;
else if(PlayerInfo[extraid][Lider] == 16) PlayerInfo[extraid][Skin] = 166;
else if(PlayerInfo[extraid][Lider] == 17) PlayerInfo[extraid][Skin] = 186;
}
}
new nijeviseadmin = 0;
if(PlayerInfo[extraid][Admin] > 0 && strcmp(AdminInfo[PlayerInfo[extraid][MjestoAdmina]][Mjesto],hIme,false)) nijeviseadmin = 1;
new nijevisegs = 0;
if(PlayerInfo[extraid][GameSage] > 0 && strcmp(GSInfo[PlayerInfo[extraid][MjestoGS]][Mjesto],hIme,false)) nijevisegs = 1;
if(PlayerInfo[extraid][Admin] > 0)
{
PrviAdmin[extraid] = 0;
admini ++;
if(admini == 1)
{
PrviAdmin[extraid] = 1;
}
}
new nxtlevel = PlayerInfo[extraid][Level]+ 1;
new expamount = nxtlevel*levelexp;
new ptime = PlayerInfo[extraid][SatiIgranja];
new wlcMsg[128];
format(wlcMsg,sizeof(wlcMsg),"*Dobrodosao na server %s,lijepo te vidjeti!",GetName(extraid));
SendClientMessage(extraid,SVIJETLOPLAVA,wlcMsg);
if(PlayerInfo[extraid][Level] > 0)
{
format(string2,sizeof(string2),"*Tvoj dosadasnji zivot: Level [%d] | Respekti [%d/%d] | Sati igranja [%d]",PlayerInfo[extraid][Level],PlayerInfo[extraid][pExp],expamount,ptime);
SendClientMessage(extraid,COLOR_WHITE,string2);
format(string2,sizeof(string2),"*Datum: %d.%s | Vrijeme: %d:%d h.",day,mtext,hour,minuite);
SendClientMessage(extraid,ZUTA,string2);
}
if(Izbacen == 1)
{
PlayerInfo[extraid][Clan] = 0;
PlayerInfo[extraid][MjestoUOrg] = 0;
PlayerInfo[extraid][Rank] = 0;
PlayerInfo[extraid][Lider] = 0;
PlayerInfo[extraid][Skin] = 23;
SetPlayerSkin(extraid,PlayerInfo[extraid][Skin]);
SCM(extraid,0xDB023EFF,"*Izbaceni ste iz svoje organizacije/bande/mafije!");
new upit[200];
format(upit,200,"UPDATE `users` SET `Clan` = '0', `Lider` = '0', `Rank` = '0',`MjestoUOrg` = '0', `Skin` = '%d' WHERE `Nick` = '%s'",PlayerInfo[extraid][Skin],hIme);
mysql_query(upit,THREAD_OSTALO);
}
if(nijeviseadmin == 1)
{
new aIme[MAX_PLAYER_NAME];
RPIme(extraid,aIme);
PlayerInfo[extraid][Admin] = 0;
PlayerInfo[extraid][MjestoAdmina] = 0;
SCMF(extraid,ZUTA,"%s,smijenjeni ste sa mjesta admina!",aIme);
SCMF(extraid,ZUTA,"%s,Vas level admina-a je promijenjen na: %d!",aIme,PlayerInfo[extraid][Admin]);
new upit[200];
format(upit,200,"UPDATE `users` SET `Admin` = '0',`MjestoAdmina` = '0' WHERE `Nick` = '%s'",hIme);
mysql_query(upit,THREAD_OSTALO);
}
if(nijevisegs == 1)
{
new gIme[MAX_PLAYER_NAME];
RPIme(extraid,gIme);
PlayerInfo[extraid][GameSage] = 0;
PlayerInfo[extraid][MjestoGS] = 0;
SCMF(extraid,ZUTA,"%s,smijenjeni ste sa mjesta gamesagesa!",gIme);
SCMF(extraid,ZUTA,"%s,Vas level gamesagesa-a je promijenjen na: %d!",gIme,PlayerInfo[extraid][GameSage]);
new upit[200];
format(upit,200,"UPDATE `users` SET `GameSage` = '0',`MjestoGS` = '0' WHERE `Nick` = '%s'",hIme);
mysql_query(upit,THREAD_OSTALO);
}
if(PlayerInfo[extraid][Donator] > 0) SCMF(extraid,SVIJETLOPLAVA,"*Vi imate jos %d bodova.",PlayerInfo[extraid][Donator]);
if(PlayerInfo[extraid][Admin] > 0)
{
new string[128];
format(string,sizeof(string),"|G-Unit|: Logiran si kao level %d Admina.",PlayerInfo[extraid][Admin]);
SCM(extraid,0xDB023EFF,string);
if(PrviAdmin[extraid] == 1)
{
SCM(extraid,COLOR_LIGHTRED,"| G-Protect | Aktiviram tihi mod...");
GProtect[0][gp_NacinRada] = 1;
mysql_query("UPDATE `g-protect` SET `NacinRada` = '1'",THREAD_OSTALO);
}
format(string2,sizeof(string2),"|GU_Admin||%d| %s ,usao na server",PlayerInfo[extraid][Admin],playername2);
PorukaAdminima(bojalv,string2,1);
PorukaGameSagesima(bojalv,string2,1);
}
if(PlayerInfo[extraid][GameSage] > 0)
{
format(string2,sizeof(string2),"|G-Unit GameSage||%d| %s ,usao na server",PlayerInfo[extraid][GameSage],playername2);
PorukaAdminima(ZELENA,string2,1);
PorukaGameSagesima(ZELENA,string2,1);
new string[128];
format(string,sizeof(string),"|G-Unit|: Logiran si kao level %d GameSagea.",PlayerInfo[extraid][GameSage]);
SCM(extraid,ZUTA,string);
}
gPlayerLogged[extraid] = 1;
EntID[extraid] = -1;
format(tmp2,sizeof(tmp2),"~n~~n~~n~~n~~r~DOBRODOSAO~n~~w~%s",playername2);
GameTextForPlayer(extraid,tmp2,4000,5);
}
}
SetPVarInt(extraid,"PrviSpawn",0);
}