15.02.2011, 21:39
Well, i have this two functions that are called when the gamemode starts.
The problem is, when AddBizFromFile is enabled AddFactionFromFile does not works, and, when i disable the Biz function the faction one is enabled but i see an error on the server console: string buffer overflow
Both the functions are these:
Can you please help me? I've tried everything with the arrays on the Biz function
The problem is, when AddBizFromFile is enabled AddFactionFromFile does not works, and, when i disable the Biz function the faction one is enabled but i see an error on the server console: string buffer overflow
Both the functions are these:
Код:
//============================================================================== // Dynamic Biz //============================================================================== stock AddBizFromFile() { new Str[67], type, Float:bX, Float:bY, Float:bZ, Owner[256], Desc[256], Payout, Price, iX, iY, iZ, interior, vw, fee, bank, bought, bTotal; mysql_query("SELECT * FROM `business`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>dfffs[256]s[256]ddfffddddd", type,bX, bY, bZ, Owner, Desc, Payout, Price, iX,iY,iZ,interior,vw,fee,bank,bought); CreateDynamicPickup(type, 1, bX, bY, bZ, -1, -1, -1, PICKUPDISTANCE); new strowner[128]; if(bought==0){ if(type==1272){ format(strowner, sizeof(strowner), "%s\nА venda por:%d / Lucro:%d", Desc, Price, Payout); CreateDynamic3DTextLabel(strowner, 0xADD8E6FF, bX, bY, bZ+0.4, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); bTotal++; } else{ format(strowner, sizeof(strowner), "%s\nА venda por:%d", Desc, Price); CreateDynamic3DTextLabel(strowner, 0xADD8E6FF, bX, bY, bZ+0.4, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); bTotal++; } } else{ if(type==1272){ format(strowner, sizeof(strowner), "%s\nPertence a:%s\nPreзo:%d / Lucro:%d", Desc, Owner, Price, Payout); CreateDynamic3DTextLabel(strowner, 0xADD8E6FF, bX, bY, bZ+0.4, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); bTotal++; } else{ format(strowner, sizeof(strowner), "%s\nPertence a:%s\nPreзo:%d", Desc, Owner, Price); CreateDynamic3DTextLabel(strowner, 0xADD8E6FF, bX, bY, bZ+0.4, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE); bTotal++; } } } } mysql_free_result(); printf("** %i\t<->\tBiz Loaded From\t<->\tMySQL\t\t **", bTotal); return 1; }
Код:
//============================================================================== // Dynamic Factions //============================================================================== stock AddFactionsFromFile() { new Str[100], factionid, nome[128], fTotal; mysql_query("SELECT * FROM `factions`"); mysql_store_result(); if(mysql_num_rows() > 0) { while(mysql_fetch_row(Str)) { sscanf(Str, "p<|>ds[128]", factionid, nome); fTotal++; } } mysql_free_result(); printf("** %i\t<->\tFactions Loaded From\t<->\tMySQL\t\t **", fTotal); return 1; }