strcat(name, FactionInfo[facid][facname]);
warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
CMD:fcreate(playerid,params[])
{
//new string[40],
new query[128], localfname[32];
if(sscanf(params,"s", localfname)) return SendClientMessage(playerid, -1, "Use: /fcreate [name]");
//if(scorelevel[playerid] < 500) return SendClientMessage(playerid, COLOR_RED, "Vocк precisa ter score/level 500 para criar uma faction");
if(GetPlayerMoneyEx(playerid) < 500000) return SendClientMessage(playerid, COLOR_RED, "You do not have 500.000");
if(fmembro[playerid] > 0) return SendClientMessage(playerid, COLOR_RED, "Vocк jб tem uma faction");
format(query,sizeof query,"SELECT COUNT(*) AS `exists` FROM factions WHERE facname='%s'",localfname);
mysql_function_query(ConnectMYSQL,query,true,"r@MySQL_CheckFaction","ds",playerid, localfname);
// /\ importante deixar o cache como TRUE.
return 1;
}
public r@MySQL_CheckFaction(playerid, name[]) {
new field[11], exists;
cache_get_field_content(0, "exists", field, ConnectMYSQL);
exists = strval(field);
if(exists) {
// jб existe
return 1;
}
new query[128];
format(query, sizeof query, "INSERT INTO factions (facname) VALUES ('%s');", name);
mysql_function_query(ConnectMYSQL,query,true,"r@MySQL_CreateFaction","d",playerid);
new facid = fmembro[playerid];
strcat(name, FactionInfo[facid][facname]); // warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
return 1;
}
public r@MySQL_CreateFaction(playerid) {
new novafacid = cache_insert_id(ConnectMYSQL);
fmembro[playerid] = novafacid;
fcargo[playerid] = 5;
GivePlayerMoneyEx(playerid,-500000);
SendClientMessage(playerid,-1,"Faction successfully created!");
new ept[30];
ept = "Empty";
new seunome[30];
seunome = PlayerName(playerid);
FactionInfo[fmembro[playerid]][lider1] = seunome;
FactionInfo[fmembro[playerid]][lider2] = ept;
FactionInfo[fmembro[playerid]][lider3] = ept;
FactionInfo[fmembro[playerid]][membro1] = ept;
FactionInfo[fmembro[playerid]][membro2] = ept;
FactionInfo[fmembro[playerid]][membro3] = ept;
FactionInfo[fmembro[playerid]][membro4] = ept;
FactionInfo[fmembro[playerid]][membro5] = ept;
FactionInfo[fmembro[playerid]][membro6] = ept;
FactionInfo[fmembro[playerid]][membro7] = ept;
FactionInfo[fmembro[playerid]][membro8] = ept;
FactionInfo[fmembro[playerid]][membro9] = ept;
FactionInfo[fmembro[playerid]][membro10] = ept;
FactionInfo[fmembro[playerid]][membro11] = ept;
FactionInfo[fmembro[playerid]][membro12] = ept;
return 1;
}
strcat(name, FactionInfo[facid][facname], sizeof(name));
//or this:
format(name,sizeof(name),FactionInfo[facid][facname]);
|
You can do this:
PHP код:
|
strcat(name, FactionInfo[facid][facname], sizeof(name));
warning 224: indeterminate array size in "sizeof" expression (symbol "")
format(name,sizeof(name),FactionInfo[facid][facname]);
warning 224: indeterminate array size in "sizeof" expression (symbol "")
format(name,sizeof(name),"%s",FactionInfo[facid][facname]);
|
Show us how you identify the variable facname
Using format can be done by this method: Код:
format(name,sizeof(name),"%s",FactionInfo[facid][facname]); |

warning 224: indeterminate array size in "sizeof" expression (symbol "")
FactionInfo[facid][facname][0] = EOS; // clear string
strcat(FactionInfo[facid][facname], name, 30); // 30 is the size of facname[30] in enum