22.07.2016, 14:53
If you want to keep all VehicleRepairs of all players, WITHOUT knowing which player did how many repairs,
you can just use a normal integer.
If you want to keep all VehicleRepairs of all players, WITH knowing which player did how many repairs,
that's where arrays are needed.
For integers:
To use an array with a tag (such as Float:, bool:, ...):
you can just use a normal integer.
Код:
//Top of script new VehicleRepairs;
that's where arrays are needed.
For integers:
Код:
//Top of script new VehicleRepairs[MAX_PLAYERS]; //An array that keeps the amount of vehicle repairs for every player //Assignement VehicleRepairs[playerid]++; //Previous value + 1 VehicleRepairs[playerid] += 5; //Previous value + 5 VehicleRepairs[playerid] = 5; //Overwrite previous value with 5 //Conditional check if(VehicleRepairs[playerid] == 0) { //No repairs }
Код:
//Top of script //Use: new Float:MyVariable[MAX_PLAYERS]; //Instead of new MyVariable[MAX_PLAYERS]; //Everything else stays the same