SA-MP Forums Archive
Only for ID 0 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Only for ID 0 (/showthread.php?tid=82824)



Only for ID 0 - arnutisz - 21.06.2009

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.


Re: Only for ID 0 - woot - 21.06.2009

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


Re: Only for ID 0 - DiDok - 21.06.2009

Post whole code, including for and returns


Re: Only for ID 0 - [nl]daplayer - 21.06.2009

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.



Re: Only for ID 0 - arnutisz - 21.06.2009

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.


Re: Only for ID 0 - arnutisz - 21.06.2009

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


Re: Only for ID 0 - [nl]daplayer - 21.06.2009

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


Re: Only for ID 0 - woot - 21.06.2009

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.


Re: Only for ID 0 - arnutisz - 21.06.2009

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.


Re: Only for ID 0 - Donny_k - 21.06.2009

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.