Only for ID 0
#1

Why the level set to 1 only for ID 0?
pawn Код:
new Level[MAX_PLAYERS] = 1;
EDIT:

Thanks for helping. I want to know hot to make levels as much as i want? I do this:
pawn Код:
#define MAX_LEVEL 100
My levels is with EXP:
To get into second level, i should get 1000 exp points.

pawn Код:
stock PlayerLevel(playerid)
{
    if(IsplayerConnected(playerid))
    {
        if(Logged[playerid])
        {
            for(new i; i<MAX_LEVEL; i++)
That's what I've done, and i don't know what to do next.
Reply
#2

What do you mean? Explain what you are going to do with it.
Reply
#3

Post whole code, including for and returns
Reply
#4

maybe something as this:
pawn Код:
new Level[MAX_PLAYERS];

public OnGameModeInit()
{
  for(new i=0; i<MAX_PLAYERS; i++) Level[i] = 1;
}
you can't set the value of array in the way you did, you need to create a loop, and set every slot of the array to the value.
Reply
#5

Quote:
Originally Posted by DiDok
Post whole code, including for and returns
There aren't more code at the moment, i am just creating this, and i wanted to check. When I connect to server(ID 0) and type stats, it shows Level = 1. When I type other player id: "stats 1", shows level 0.

Quote:
Originally Posted by .:NoZer0:.
maybe something as this:
pawn Код:
new Level[MAX_PLAYERS];

public OnGameModeInit()
{
  for(new i=0; i<MAX_PLAYERS; i++) Level[i] = 1;
}
you can't set the value of array in the way you did, you need to create a loop, and set every slot of the array to the value.
Thanks.
Reply
#6

But is it works, when player will gain level 2, 3..... The level will be changed, or it will be 1 always?
Reply
#7

Quote:
Originally Posted by Scott[LT
]
But is it works, when player will gain level 2, 3..... The level will be changed, or it will be 1 always?
how you mean?, you're using PEN:LS, or GF?, yes this will just set it to the 1, and the rest of the script will update the variable
Reply
#8

pawn Код:
Level[playerid] = 1;
^ Sets the players level who connects or w/e to 1. (OnPlayerConnect)

Now, if he killed someone or whatever you do ..

pawn Код:
Level[playerid]++;
^ It will become 2 then.
Reply
#9

Quote:
Originally Posted by .:NoZer0:.
Quote:
Originally Posted by Scott[LT
]
But is it works, when player will gain level 2, 3..... The level will be changed, or it will be 1 always?
how you mean?, you're using PEN:LS, or GF?, yes this will just set it to the 1, and the rest of the script will update the variable
No, i don't using any other GM's.

Quote:
Originally Posted by //exora
pawn Код:
Level[playerid] = 1;
^ Sets the players level who connects or w/e to 1. (OnPlayerConnect)

Now, if he killed someone or whatever you do ..

pawn Код:
Level[playerid]++;
^ It will become 2 then.
So level will update to next level. and if I'll save player level to file, and when player connects he will gain not level 1 but the level which written in file?, i think.

Sorry for my English, hope you understand.
Reply
#10

pawn Код:
new Level[ MAX_PLAYERS ] = { 1, ... };
You don't need a loop, just initialise it like the above example and yes if you supply an index (playerid) and increment it by one (++) then only the value at that index will be modified.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)