This variable is confusing...
#1

I've been looking at some tutorials and I keep seeing this variable with an array pop up.

new (Name Of Variable)[MAX_PLAYERS];

Then they'd put "playerid" inside it. I'm almost positive this loops through all players connected but I still don't know how to use it in code. Can you give me some examples on how to use this kind of variable? Explanations would be helpful too; thanks!

Can you explain what this does too?

OnPlayerConnect(playerid)
{
AFKTime[playerid] = SetTimer("AFKCheck",1000,1);
}
Reply
#2

It'll basically create a repeated timer of 1 sec whenever a player connects. (it assigns the timer to the specific player - which means to every player connected separately)
Reply
#3

Quote:
Originally Posted by Uuri
Посмотреть сообщение
I've been looking at some tutorials and I keep seeing this variable with an array pop up.

new (Name Of Variable)[MAX_PLAYERS];

Then they'd put "playerid" inside it. I'm almost positive this loops through all players connected but I still don't know how to use it in code. Can you give me some examples on how to use this kind of variable? Explanations would be helpful too; thanks!
What is a variable ?

And

pawn Код:
OnPlayerConnect(playerid)
{
   AFKTime[playerid] = SetTimer("AFKCheck",1000,1);
}
Creates a timer when a player connect, You should kill it when the player disconnect too, Or make one on the gamemode/filterscript init with a loop and check if the player is connected
Reply
#4

Thanks guys, can you explain to me how this 2 dimensional array works too?

Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#5

You should learn to Search and ******
What are enums ?
Reply
#6

I know what enums are, I'm just new to this language. Thanks anyway.
Reply


Forum Jump:


Users browsing this thread: