numarg() - ia numarul care il scrii tu in loc de acele 3 puncte ( ... )
getarg() - ia numarul la care se afla ( prima oara ia ID 0 , apoi trece la ID 1 etc)
Exemplu: GetName(0,1,2,3); ( ia numele la cei 4 cu id-urile: 0 , 1 , 2 , 3 );
Virtual , you have done something wrong ...
pawn Код:
stock GetNames(...)
{
new names[29], pnames[MAX_PLAYER_NAME], num;
for(new i; i<numargs(); i++) if(IsPlayerConnected(getarg(i)))
{
num++;
GetPlayerName(getarg(i), pnames, MAX_PLAYER_NAME);
format(names, sizeof(names), "Number %d: [ID:%i] Name: %s",num,getarg(i),pnames);
}
return names;
}
@ Don't use ++i , because if we do something like this : GetNames(0,1,2); first ID will take
1 ... just do i++
@@ After he finish the loop , he will return just the last names ( eg: GetNames(0,1,2) .. he will return just from ID 2)
@@@ If the player is not connected , he still return the names, because is not in the loop ...
So , the function must have a new parameter , playerid and the function must be corrected ... e.g:
pawn Код:
stock GetNames(playerid, ...)
{
new names[64], pnames[MAX_PLAYER_NAME], num;
for(new i; i<numargs(); i++)
{
if(IsPlayerConnected(getarg(i)))
{
num++;
GetPlayerName(getarg(i), pnames, MAX_PLAYER_NAME);
format(names, sizeof(names), "Number %d: [ID:%i] Name: %s",num,getarg(i),pnames);
SendClientMessage(playerid,0xDA635CFF,names);
}
else continue;
}
}