Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-23-2008, 10:59 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
There are two ways to add a weapon... one, is initializing it on the serverside. That's as simple as doing...
PHP Code:
findplayer("DustyPorViva").addweapon("Bomb"); 
The other method involves triggering the serverside and adding it... which is more common.
PHP Code:
function onActionserverside() { // when the server is triggered, via triggerserver
  
if (params[0] == "addbomb") { // Check to see what 'command' is being sent
    // params[0] will be the first parameter you sent through the trigger... assuming you know how triggers and parameters work
    
findplayer(params[1]).addweapon("Bomb"); 
    
// findplayer() will pinpoint an account and addweapon to the player.
    // findplayer() is very important serverside, as a server holds the data of ALL players, you need to be specific.
  
}
}
//#CLIENTSIDE
// ^ That means everything under this line is on the clientside
function onPlayerchats() {
  if (
player.chat=="/addbomb") { // if the player says /addbomb
    
triggerserver("gui",name,"addbomb",player.account);
    
/* trigger the server
       GUI simply means you are triggering a weapon... don't change that
       NAME means you're triggering THIS weapon... you can change that to another weapon if you want to trigger another
       "ADDBOMB" will be used as a command of sort, so you can interpret it on the serverside as what you're doing
       player.account -- we need to send this info so the server knows which player to add the weapon to
    */
  
}

Reply With Quote
 

Tags
nightmare, npcserver, scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.