AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to declare array to save speed per lvl (https://forums.alliedmods.net/showthread.php?t=251691)

avril-lavigne 11-17-2014 12:15

how to declare array to save speed per lvl
 
I know its simple ... brain exploding.

new Float:speedlvl[33]

I need to save 7 levels there like { 250.0, 270.0, .... etc }

new Float:speedlvl[33][7] ??

HamletEagle 11-17-2014 12:36

Re: how to declare array to save speed per lvl
 
So for each player index you would like to have 7 levels and to use them like
Code:
array[index][0] = x.y array[index][6] = a.b

If so, yes.

fysiks 11-17-2014 19:32

Re: how to declare array to save speed per lvl
 
Quote:

Originally Posted by avril-lavigne (Post 2225385)
I know its simple ... brain exploding.

new Float:speedlvl[33]

I need to save 7 levels there like { 250.0, 270.0, .... etc }

new Float:speedlvl[33][7] ??

There is no reason to store each of the speeds for each person. Simply have one array for players that contains the speed level number and have another array for the speeds.

PHP Code:

new g_iPlayerSpeedLevel[33]
new 
Float:g_fSpeedLevesl[7] = {250.0,  270.0, .... etc

Then, when you need to get a player's speed, you simply do this:

PHP Code:

new Float:ThisPlayersSpeed g_fSpeedLevels[g_iPlayerSpeedLevel[id]] 

where 'id' is the player index.


All times are GMT -4. The time now is 17:39.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.