View Single Post
  #1  
Old 11-23-2009, 12:19 AM
Jman9912 Jman9912 is offline
Registered User
Join Date: Jun 2001
Location: North Carolina
Posts: 114
Jman9912 is on a distinguished road
Send a message via AIM to Jman9912
Day/Night system

I'm working on a basic day night system for practice. Here is what I have so far as it is really basic. Still adapting to GS2. I was wondering if anyone could give me any suggestions and help me improve on it.

NPC Code:

//#CLIENTSIDE
function onCreated() {
client.time=0;
Initialize();
}

function Initialize() {
for (client.time == 0;client.time <= 23;client.time++) {
if (client.time >= 0 && client.time<2) {
seteffect 0,0,0,.7;
}

if (client.time >=3 && client.time <= 5) {
seteffect 0,0,0,.5
}

if (client.time >= 6 && client.time <=8) {
seteffect 0,0,0,.3;
}

if (client.time >=9 && client.time <=12) {
seteffect 0,0,0,.1;
}

if (client.time >=13 && client.time <=17) {
seteffect 0,0,0,0;
}

if (client.time >=18 && client.time <=21) {
seteffect 0,0,0,.3;
}

if (client.time >=22 && client.time <=24) {
seteffect 0,0,0,.5;
}

sleep(2);

if (client.time==24) {
client.time = 0;
}
echo(client.time);
showtext(128,50,150,$pref::graal::defaultfontname, "bc","Time: " @ client.time @ ":00");
changeimgvis 128,4;
}
}

Reply With Quote