PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
RegConsoleCmd("test", test);
}
public Action:test(client, args)
{
if (!(0 < client <= MaxClients))
return Plugin_Handled;
decl player_list[MaxClients]; new players = 0;
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i)) player_list[players++] = i;
}
Shake_(player_list, players);
return Plugin_Handled;
}
Shake_(const player_list[], const players)
{
if (players < 1)
return;
new Handle:Message = StartMessage("Shake", player_list, players); // error 035: argument type mismatch (argument 2)
if (Message != INVALID_HANDLE)
{
// blabla (not important)
}
}
To avoid this error, I must to do this:
PHP Code:
Shake_(const player_list[], const players)
{
if (players < 1)
return;
decl list[players];
for (new i = 0; i < players; i++)
list[i] = player_list[i];
new Handle:Message = StartMessage("Shake", list, players);
}
I do not understand what is wrong in the first variant.
I understand I can do without the function "Shake_"