Could someone help me decipher this a little?
#1

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;
}
Someone assisted me in writing this system, due to taking a break from SAMP and changing computers I've completely forgot. The comments have been written by them.

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.
Reply


Messages In This Thread
Could someone help me decipher this a little? - by Dokins - 29.11.2014, 15:46
Re: Could someone help me decipher this a little? - by Raweresh - 29.11.2014, 16:52
Re: Could someone help me decipher this a little? - by Dokins - 29.11.2014, 17:20
Re: Could someone help me decipher this a little? - by sammp - 29.11.2014, 17:30
Re: Could someone help me decipher this a little? - by Dokins - 29.11.2014, 17:38
Re: Could someone help me decipher this a little? - by PT - 29.11.2014, 17:45
Re: Could someone help me decipher this a little? - by Dokins - 29.11.2014, 18:24
Re: Could someone help me decipher this a little? - by sammp - 29.11.2014, 19:22

Forum Jump:


Users browsing this thread: 1 Guest(s)