Simple beginner question
#4

Yes, it is defined in the a_samp.inc include provided with the default SA-MP server package, in the latest SA-MP server package, it is defined as 500. So what you're really writing is

pawn Код:
new variable[500];
This creates an array with 500 writable cells, the last cell is used for the null termination character.

Each cell can store an integer or a single character, so you may also be able to use arrays as strings, however in this case, this type of array is usually used in SA-MP for storing things per player. For example:

pawn Код:
public OnPlayerConnect(playerid)
{
    variable[playerid] = playerid * 2;
    return 1;
}
So whenever you refer to the variable, you can refer to a certain cell by playerid which is storing a value, in this case, the variable stores that playerid's ID multiplied by 2, so if your ID is 10, that variable will contain 20. This is how we generally make variables to store temporary information for each player.

I hope that helps.
Reply


Messages In This Thread
Simple beginner question - by sim_sima - 26.02.2011, 14:30
Re: Simple beginner question - by MP2 - 26.02.2011, 14:32
Re: Simple beginner question - by sim_sima - 26.02.2011, 14:33
Re: Simple beginner question - by JaTochNietDan - 26.02.2011, 14:53
Re: Simple beginner question - by sim_sima - 26.02.2011, 15:06

Forum Jump:


Users browsing this thread: 2 Guest(s)