You're mixing a GS2 function definition with GS1 commands, please don't.
ActionPlayerOnline is called in the Control-NPC when a player logs in, you would do:
PHP Code:
function onActionPlayerOnline() {
addweapon("weapon1");
addweapon("weapon2");
}
This script would go in the Control-NPC.