Thread: Quick Question
View Single Post
  #6  
Old 11-02-2011, 01:16 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Here's why it won't work (don't want you to get confused by the inexperienced others):

1. putnpc isn't used anymore, and you'll have to create a class called beer instead. Use putnpc2 like this instead:

PHP Code:
function onCreated() {
  
temp.npc putnpc2(x,y,"");
  
temp.npc.join("class_name");

2. onActionLeftMouse only applies when you click an NPC. You have to use client-side events in a weapon script and send that data to the server-side then create the npc. Search the forums for triggerserver examples.

PHP Code:
//#CLIENTSIDE

function GraalControl.onMouseDown() {
  
player.chat format("Clicked! X: %s Y: %s"mousexmousey);

3. If you want the 'beer' to be destroyed 10 seconds after it's created you'll have to use the onCreated event and a timeout.

PHP Code:
function onCreated() {
  
setTimer(10); // Schedules a Timeout in 10 seconds from now.
}

function 
onTimeout() {
  
// Timeout occured
  
destroy();

__________________
Quote:
Reply With Quote