Quote:
Originally Posted by mrnothersan
Right... so my NPC script currently looks like this:
PHP Code:
function onActionPlayerOnline() { player.addWeapon("testgui","Tailor"); }
(from a previous script and i just add ... will it still work if i remove ?
EDIT: I removed player. and applied... entered game and it 1.Removed all my tools. 2.Didn't give me testgui or Tailor....
|
Don't remove the prefix. The code Jer posted was perfect:
Quote:
Originally Posted by fowlplay4
PHP Code:
function onActionPlayerOnline() { // Array of weapons to add to the player. temp.weps = { "-System", "OtherWeapon", "Example" }; // Loops through each weapon in the array and adds it to the player. for (temp.wep: temp.weps) { player.addweapon(temp.wep); } }
|
TServerPlayer.addWeapon(str) only accepts one parameter (the weapon name). To add multiple weapons, you have to call it multiple times.
PHP Code:
function onActionPlayerOnline() {
player.addWeapon("-System");
player.addWeapon("-Tailor");
// etc
}
Jer's example (which I quoted above) does the same thing in a much nicer way using loops and arrays.