29.11.2014, 15:46
pawn Код:
//well point one: I gave a bad name to the function, it should better be called "GetWeaponTableIndex" or so...
//when we use the variables like "WepAmmo, WepModel" or whatever, we use the data that you read from the mysql table
//and stored in those variables... And there the Indizes are different to the IDs in the mysql
//so if we have a SQLID we first need to find the correct INDEX that is shadowing this SQLID
//As we have WepSQLID we can look at which Index WepSQLID matches to the SQLID we have at PlayerWeapon
//But all the time when we use some data that we pre-saved in the variables we need to use the Index of the serverside table
//instead of the SQLID
stock GivePlayerWeaponEx(playerid)
{
for(new w = 0; w < 13; w++)
{
new id = GetWepIndexFromSQL(PlayerWeapons[playerid][w]);
printf("WeaponID: %d", id);
if(id < 0)
continue;
if(WepAmmo[id] > 0)
{
GivePlayerWeapon(playerid,WepModel[id],WepAmmo[id]);
printf("Weapon: %d, Ammo: %d", WepModel[id], WepAmmo[id]);
}
}
return 1;
}
Basically
PlayerWeapons[playerid][w] saves the MySQLID of the weapon (not model).
So I don't understand the serverside index thing?
Any advice would be great.
