for(new i = 1; i <= gang_members; i++){format(query2, sizeof(query2), \"SELECT * FROM `userek` WHERE `gang_id` = \'%d\' \",playerGang);mysql_query(query2);mysql_store_result(); mysql_fetch_row(line);sscanf(line, \"p<|>ds[128]s[128]dddd\",str[0],str[1]); format(string, sizeof(string),\"%s\",str[1]); SendClientMessage(playerid, COLOR_BLUE, string);}
másik megoldás akkor hogy van??
if(strcmp(cmd, \"/gangstats\", true) == 0){new line[500],query8[500],nick; format(query8, sizeof(query8), \"SELECT * FROM `users` WHERE `gang_id` = \'%d\' \", playerGang); mysql_query(query8);mysql_store_result();while(mysql_fetch_row(line)){sscanf(line, \"p<|>ds[50]s[50]s[50]dddddddddddddd\",0,nick,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);format(string, sizeof(string),\"Játékos név: %s\",nick);SendClientMessage(playerid, COLOR_RED, string);}mysql_free_result();return 1;}
basszus nem is tudtam hogy a sa-mpos mysqlbe van while XDXDDupla hozzászólás automatikusan összefûzve. ( 2011. augusztus 21. - 12:13:39 )igy is csak egyet mutat kettö helyet:(el rontottam valamit?? if(strcmp(cmd, \"/gangstats\", true) == 0){new line[500],query8[500],nick; format(query8, sizeof(query8), \"SELECT * FROM `users` WHERE `gang_id` = \'%d\' \", playerGang); // Mi ez a playerGang? ezzel leszûkíted egy adott sorra az egészet. mysql_query(query8);mysql_store_result();while(mysql_fetch_row(line)){sscanf(line, \"p<|>ds[50]s[50]s[50]dddddddddddddd\",0,nick,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); // Ez mi a f*** darabol ennyit?format(string, sizeof(string),\"Játékos név: %s\",nick); // Ok kiírjuk a játékos nevet de akkor minek van feljebb mysql függvény?SendClientMessage(playerid, COLOR_RED, string);}mysql_free_result();return 1;}
if(strcmp(cmd, \"/gangstats\", true) == 0){new line[500],query8[500],nick; format(query8, sizeof(query8), \"SELECT * FROM `users` WHERE `gang_id` = \'%d\' \", playerGang); // Mi ez a playerGang? ezzel leszûkíted egy adott sorra az egészet. mysql_query(query8);mysql_store_result();while(mysql_fetch_row(line)){sscanf(line, \"p<|>ds[50]s[50]s[50]dddddddddddddd\",0,nick,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); // Ez mi a f*** darabol ennyit?format(string, sizeof(string),\"Játékos név: %s\",nick); // Ok kiírjuk a játékos nevet de akkor minek van feljebb mysql függvény?SendClientMessage(playerid, COLOR_RED, string);}mysql_free_result();return 1;}
if(strcmp(cmd, \"/gang\", true) == 0) { new gangcmd;tmp = strtok(cmdtext, idx);if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /gang [create/join/invite/quit] [name/number]\"); return 1;}giveplayerid = strval(tmp);if(strcmp(tmp, \"create\", true)==0) gangcmd = 1;else if(strcmp(tmp, \"invite\", true)==0) gangcmd = 2;else if(strcmp(tmp, \"join\", true)==0) gangcmd = 3;else if(strcmp(tmp, \"quit\", true)==0) gangcmd = 4;tmp = strtok(cmdtext, idx);if(gangcmd < 3 && !strlen(tmp)) { if(gangcmd==0) SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /gang [create/join/invite/quit] [name/number]\"); else if(gangcmd==1) SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /gang [create] [name]\"); else if(gangcmd==2) SendClientMessage(playerid, COLOR_WHITE, \"USAGE: /gang [invite] [playerID]\"); return 1;}//Create Gang//if(gangcmd==1) { if(playerGang[playerid]>0) { SendClientMessage(playerid, COLOR_RED, \"Már bandába Vagy!\"); return 1; }else{ new playername3[MAX_PLAYER_NAME]; new line[500]; GetPlayerName(playerid, playername3, sizeof(playername3)); new query[500],query5[500],query2[500]; mysql_real_escape_string(tmp,tmp); format(query, sizeof(query),\"INSERT INTO gangs (id,ganga_name,gang_fonok,gang_haz,gang_szin,gang_bank,gang_members)VALUES(0,\'%s\',\'%s\',\'0\',\'%d\',\'0\',\'1\')\",tmp,playername3,GetPlayerColor(playerid)); mysql_query(query); format(query5, sizeof(query5), \"SELECT * FROM `gangs` WHERE `gang_fonok` = \'%s\' \",playername3); mysql_query(query5); mysql_store_result(); mysql_fetch_row(line); sscanf(line, \"p<|>dsp<|>[128]\",playerGang,gangname); format(string, sizeof(string),\"Te Bandát Csináltál \'%s\' (id: %d)\",gangname,playerGang[playerid]); SendClientMessage(playerid, COLOR_GREEN, string); format(query2, sizeof(query2), \"UPDATE `userek` SET gang_id=\'%d\' WHERE `jatekosnev` = \'%s\'\",playerGang[playerid],playername3); mysql_query(query2); mysql_free_result(); return 1;}//Join Gang//} else if (gangcmd==3) { if(playerGang[playerid]>80) { SendClientMessage(playerid, COLOR_RED, \"Már bandába Vagy!\"); return 1; } if(gangInvite[playerid]==0) { SendClientMessage(playerid, COLOR_RED, \"Nincs Banda Megívód!!!\"); return 1; } if(gangInvite[playerid] != 0) { if(IsPlayerConnected(giveplayerid)) { new query2[500],line[500],query4[500],gang_members; format(query2, sizeof(query2), \"SELECT * FROM `gangs` WHERE `id` = \'%d\' \", gangInvite); mysql_query(query2); mysql_store_result(); mysql_fetch_row(line); sscanf(line, \"p<|>ds[128]s[128]dddd\",0,gangname,0,0,0,0,gang_members); format(string, sizeof(string),\"Te Beléptél A Bandába \'%s\' (id: %d)\", gangname, gangInvite); SendClientMessage(playerid, COLOR_GREEN, string); new playername5[MAX_PLAYER_NAME]; GetPlayerName(giveplayerid, playername5, sizeof(playername5)); new i; for (i = 0; i < MAX_PLAYERS; i++) { if(gangInvite == playerGang) { format(string, sizeof(string),\" %s Belépet a bandába!!!\",playername5); SendClientMessage(i, COLOR_GREEN, string); } } new playername3[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername3, sizeof(playername3)); format(query2, sizeof(query2), \"UPDATE `userek` SET gang_id=\'%d\' WHERE `jatekosnev` = \'%s\'\",gangInvite,playername3); mysql_query(query2); gang_members++; format(query4, sizeof(query4), \"UPDATE `gangs` SET gang_members=\'%d\' WHERE `id` = \'%d\'\",gang_members,gangInvite); mysql_query(query4); mysql_free_result(); gangInvite[playerid] =0; return 1; } } return 1;//Invite to Gang//} else if (gangcmd==2) { giveplayerid = strval(tmp); if(playerGang[playerid]==0) { SendClientMessage(playerid, COLOR_RED, \"Nem vagy Bandába!\"); return 1; }// if(gangMembers[playerGang[playerid]][0]!=playerid) {// SendClientMessage(playerid, COLOR_RED, \"You need to be the gang leader to send an invite.\");// return 1;// } new playername3[MAX_PLAYER_NAME]; new query2[500]; GetPlayerName(playerid, playername3, sizeof(playername3)); format(query2, sizeof(query2), \"SELECT * FROM `gangs` WHERE `gang_fonok` = \'%s\' \",playername3); mysql_query(query2); mysql_store_result(); if(mysql_num_rows() == 1) { if(IsPlayerConnected(giveplayerid)) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new query[500],line[500]; format(query, sizeof(query), \"SELECT * FROM `gangs` WHERE `gang_fonok` = \'%s\' \",giveplayer); mysql_query(query); mysql_store_result(); mysql_fetch_row(line); sscanf(line, \"p<|>ds[128]p<|>\",0,gangNames[playerGang[playerid]]); format(string, sizeof(string),\"Banda Meghívót Kültél %s-nek %s.\", giveplayer); SendClientMessage(playerid, COLOR_GREEN, string); format(string, sizeof(string),\"Te Kaptál Banda Meghívót %s tól \'Banda név \'%s\' (id: %d) /gang join nal aktiválhatod!! \", sendername, gangNames[playerGang[playerid]],playerGang[playerid]); SendClientMessage(giveplayerid, COLOR_GREEN, string); gangInvite[giveplayerid]=playerGang[playerid]; mysql_free_result(); } else SendClientMessage(playerid, COLOR_RED, \"Nincs Ilyen Játékosid!\"); }else{ SendClientMessage(playerid, COLOR_RED, \"Nem vagy banda fõnök!!!\"); }//Leave Gang//} else if (gangcmd==4) { if(playerGang[playerid]==0) { SendClientMessage(playerid, COLOR_RED, \"Nem vagy Bandába!\"); return 1; } new query10[500],line[500]; new playername3[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername3, sizeof(playername3)); format(query10, sizeof(query10), \"SELECT * FROM `gangs` WHERE `gang_fonok` = \'%s\' \",playername3);//ha csak a bada fönök statját mutaja mysql_query(query10); mysql_store_result(); mysql_fetch_row(line); sscanf(line, \"p<|>ds[128]p<|>\",playerGang[playerid],gangname);//<-- ezért ha nem fönök akkor0 értékeket kap:( if(mysql_num_rows()== 1) { new guery2[500],query3[500]; format(guery2, sizeof(guery2), \"UPDATE `userek` SET gang_id=\'%d\' WHERE `jatekosnev` = \'%s\'\",0,playername3); mysql_query(guery2); format(query3, sizeof(query3), \"DELETE FROM gangs WHERE gang_fonok= \'%s\' \",playername3); mysql_query(query3); format(string, sizeof(string),\"Kiléptél a bandából: \'%s\' (id: %d)\",gangname,playerGang[playerid]); SendClientMessage(playerid, COLOR_RED, string); playerGang[playerid]=0; mysql_free_result(); }else{ new guery4[500],guery7[500],guery5[500],gang_members; format(guery7, sizeof(guery7), \"SELECT * FROM `gangs` WHERE `id` = \'%d\' \",playerGang[playerid]); mysql_query(guery7); mysql_store_result(); mysql_fetch_row(line); sscanf(line, \"p<|>ds[128]s[128]dddd\",0,gangname,0,0,0,0,gang_members); format(guery4, sizeof(guery4), \"UPDATE `userek` SET gang_id=\'%d\' WHERE `jatekosnev` = \'%s\'\",0,playername3); mysql_query(guery4); gang_members--; format(guery5, sizeof(guery5), \"UPDATE `gangs` SET gang_members=\'%d\' WHERE `id` = \'%d\'\",gang_members,playerGang); mysql_query(guery5); format(string, sizeof(string),\"Kiléptél a bandából: \'%s\' (id: %d)\",gangname,playerGang); SendClientMessage(playerid, COLOR_RED, string); playerGang[playerid]=0; mysql_free_result(); }} return 1;}//------------------- /gangsif(strcmp(cmd, \"/gangstats\", true) == 0){new line[500],query8[500],nick; format(query8, sizeof(query8), \"SELECT * FROM `users` WHERE `gang_id` = \'%d\' \",playerGang[playerid]); mysql_query(query8);mysql_store_result();while(mysql_fetch_row(line)){sscanf(line, \"p<|>ds[50]p<|>\",0,nick);format(string, sizeof(string),\"Játékos név: %s\",nick);SendClientMessage(playerid, COLOR_RED, string);}mysql_free_result();return 1;}