Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-21-2011, 12:59 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Server Weather Concept

I havnt expanded it much but im sure this will help someone
Anyway here you go.

Instructions:
Add as a weapon and add to yourself, then add the accounts you want to be able to change the weather in this.allowed and write /weather *Type*
the types are as followed.
Day, MidDay, Dusk, Night, MidNight, Dawn
Enjoy having a play around with this.
-Gunderak

PHP Code:
function onActionServerSide() {
  if (
params[0] == "changeweather") {
    
serverr.time params[1];
    
player.chat "Weather Set To: " params[1];
  }
}

//#CLIENTSIDE
function onCreated() {
  
this.allowed = {
    
"Graal780374","Graalblahblah"
  
};
  
onTimeout();
}

function 
onTimeout() {
  new 
GuiTextCtrl("Time") {
    
profile GuiBlueTextProfile;
    
height 20;
    
text serverr.time;
    
width 200;
    
60;
    
85;
    
red 1;
    
green 1;
    
blue 1;
    
hint "Health";
  }
  if (
serverr.time == "Night") {
    
seteffect(0000.8);
  }
  if (
serverr.time == "Day") {
    
seteffect(0000.2);
  }
  if (
serverr.time == "MidDay") {
    
seteffect(0.05000);
  }
  if (
serverr.time == "Dawn") {
    
seteffect(0.05000.6);
  }
  if (
serverr.time == "Dusk") {
    
seteffect(0.05000.6);
  }
  if (
serverr.time == "MidNight") {
    
seteffect(0000.9);
  }
  
Time.text serverr.time;
  
settimer(0.05);
}

function 
onPlayerchats() {
  if (
player.account in this.allowed) {
    if (
player.chat.starts("/weather")) {
      
triggerserver("weapon"this.name"changeweather"player.chat.substring(9));
    }
  }

__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 09-21-2011, 01:04 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
For some reason I feel like you've been told to do checks on serverside (for allowed players) at least three or four times now.
__________________
Reply With Quote
  #3  
Old 09-21-2011, 03:58 PM
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
These "concept" threads you've been posting are just becoming spam, especially when they contain bad-practices/errors we've already tried to tell you to fix and because of that it really negates their helpfulness.

1. Don't constantly re-create GUI objects. Create them once, and update their variables.
2. Move the 'allowed' validation to the server-side.
3. You don't need to use a 0.05 loop, for a weather system you can easily get away with 0.5-1. If only staff can change the weather then you don't really need it at all.
4. When you "change the weather" send a trigger to everyone on to update the weather on the client-side.
__________________
Quote:
Reply With Quote
  #4  
Old 09-21-2011, 05:48 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Also, I wouldn't really consider a time of day, weather. ..
Me: "Hey old chum, what's the weather like up there?". You: "Night."

Sound right to you.. ?
Reply With Quote
  #5  
Old 09-21-2011, 05:55 PM
SlikRick SlikRick is offline
Retired
Join Date: Aug 2003
Location: Minnesota,USA
Posts: 685
SlikRick is on a distinguished road
Wouldn't this be more of a day/night system rather then a weather system?
Reply With Quote
  #6  
Old 09-22-2011, 08:46 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
il stop posting for a while, and take the time to fix some of my scripts up.
sorry to anyone who is annoyed with all my scripts here.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
Reply


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 05:47 PM.


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