29.11.2014, 17:20
pawn Код:
stock GetWepIndexFromSQL(weapid)//returns the INDEX of the serverside database (PlayerWeapons[playerid][w] by giving the SQLID as parameter
{//needed when using WepVARIABLES
new rst = -1;
new string[40];
format(string, sizeof(string), "SELECT `id` FROM `weapons`");
mysql_query(string);
mysql_store_result();
new maxr = mysql_num_rows();
mysql_free_result();
for(new n=0; n<maxr; n++)
{
if(weapid == WepSQLID[n]) //at this point ==> weapid is the SQLID we have from PlayerWeapons
{//and WepSQLID[n] is the SQL ID that is stored in the serverside table... n is the specific index (the number
rst = n;//that we need)... Ahh. But if PlayerWeapons stores the SQLID? PlayerWeapons stores the SQLID, I don't
break;// get your question:D
}
}
return rst;
}