About SetTimerEx
#1

new PlayerName[MAX_PLAYERS]

ีi want to use this for SetTimerEx , i want to use this function for GetPlayerName() function but i don't know how to use Format syntax with array.

someone please tell me , if u have example for me will be so good.
sorry for my bad english.
Reply
#2

You mean this?
pawn Код:
new name[MAX_PLAYERS];
        new string[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, 256, "*** %s(ID: %d) has joined the server.", name, playerid);
        SendClientMessageToAll( 0xFF9900AA, string );
Reply
#3

oh sorry i'm wrong

i want to use new PlayerName[MAX_PLAYERS] for SetTimerEx

GetPlayerName <- this is exam function

exam SetTimerEx("GetPlayerName",10000,false,format syntax , PlayerName[playerid]);

i don't know how to use it with variables type array
Reply
#4

Lol the name string should not be MAX_PLAYERS in size, MAX_PLAYER_NAME it is... :P
Reply
#5

1) MAX_PLAYERS is 500, and it's too big for names(Big waste of cells), use MAX_PLAYER_NAME that's 24.

2) Do you mean:

pawn Код:
new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,sizeof(name));
  SetTimerEx("CallbackName", time_in_ms, repeating, "s", name);
Reply
#6

Please explain better.

pawn Код:
forward NameFunction(playerid);

public OnPlayerConnect(playerid)
{
     SetTimerEx("NameFunction", 5 * 1000, false, "i", playerid); // Wait 5 seconds before executing "NameFunction" With playerid as an parameter.
     return 1;
}

public NameFunction(playerid)
{
     new string[62]; // str leng = 32 + Name len = 57 + id len = 60
     format(string, sizeof(string), "Welcome %s [ %d ] To our server.", GetPlayerNameEx(playerid), playerid);
     SendClientMessageToAll(COLOR, string);
     return 1;
}

stock GetPlayerNameEx(playerid)
{
     new pName[25];
     GetPlayerName(playerid, pName, sizeof(pName));
     return pName;
}
Reply
#7

Oh thx a lot it cool
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)