Setweather and Settime.

Started by [VM_U]Spectra.PhantoM^, Feb 12, 2016, 09:25 AM

Previous topic - Next topic

[VM_U]Spectra.PhantoM^

really easy as hell but usefull for newbies.
else if (cmd == "setweather")
{
MessagePlayer("Whew u set the weather!!! YAY!", player);
SetWeather( text.tointeger() );
}

else if (cmd == "settime")
{
MessagePlayer("Whew u set the time to something!!! YAY!", player);
SetHour( GetTok(text, " ", 1) );
SetMinute( GetTok(text, " ", 2) ):
}
old settime cmd:
else if (cmd == "settime")
{
MessagePlayer("Whew u set the time to something!!! YAY!", player);
SetHour( text.tointeger() );
}
Updated.
Wanna Talk To Me? Come At Irc #Jugo@LUNet

.

#1
How dafuq does this count as a snippet? You just have two if statements and 4 function calls that could probably fit in a 'hello world' example. Because of people like you most new users have issues finding decent snippets because they have to ignore all the sh!t you people post.
.

[VM_U]Spectra.PhantoM^

i said its  for newbies didnt i? not for old members who know everything. its for ones who are new to scripting ok chill out.
Wanna Talk To Me? Come At Irc #Jugo@LUNet

.

Quote from: tard above ^^^ on Feb 12, 2016, 09:39 AMi said its  for newbies didnt i? not for old members who know everything. its for ones who are new to scripting ok chill out.

If you're so eager to post "tutorials" on how to call a function why not do that in the documentation? Don't you think that will be more helpful then a shitty topic here to be buried by the next shitty posts?
.

Anik

How is it useful for newbies?? This examples are already there in the wiki of vcmp -_-

Buddy

Quote from: [DS]Anik on Feb 12, 2016, 09:43 AMHow is it useful for newbies?? This examples are already there in the wiki of vcmp -_-
Buddy

KAKAN

Well, I tried this,
/setweather abc
It gave me error :( I'm a newbie, help me
oh no

MatheuS

Well, I tried this,
/settime twelve and a half
and also I am in error, please help me
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

[VM_U]Spectra.PhantoM^

Quote from: KAKAN on Feb 12, 2016, 10:47 AMWell, I tried this,
/setweather abc
It gave me error :( I'm a newbie, help me
kakan it only detects 1-infinitenumbers not alphabets 2nd, Ur not a newbie afaik.
and settime works with only two or one number like 12, 1, 25 no 25 and half. though im working on 1 and a half and so on values

Wanna Talk To Me? Come At Irc #Jugo@LUNet

Anik

Quote from: {ultimatejugo] on Feb 12, 2016, 11:46 AM
Quote from: KAKAN on Feb 12, 2016, 10:47 AMWell, I tried this,
/setweather abc
It gave me error :( I'm a newbie, help me
kakan it only detects 1-infinitenumbers not alphabets 2nd, Ur not a newbie afaik.
and settime works with only two or one number like 12, 1, 25 no 25 and half. though im working on 1 and a half and so on values
-_- Why DOnt YOu add this line??
if ( !IsNum( text ) )  ClientMessage("** [ERROR]: >>ID Must Be In Numbers.", player,0,205,0 );

[VM_U]Spectra.PhantoM^

Updated topic due to requests of changing the minute along with the hour.
Wanna Talk To Me? Come At Irc #Jugo@LUNet

Anik

I got an error with the updated one. The Index 'GetTok' Does not exist. Please Help ME!!! I am Newbie....

Cool

Lol why you guys taking a class of him leave him alone if you dont like his work
and your error answer
function GetTok(string, separator, n, ...)
{
 local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";
 
 if (n > tokenized.len() || n < 1) return null;
 for (; n <= m; n++)
 {
  text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
 }
 return text;
}

[VM_U]Spectra.PhantoM^

Quote from: [DS]Anik on Feb 12, 2016, 12:16 PMI got an error with the updated one. The Index 'GetTok' Does not exist. Please Help ME!!! I am Newbie....
anik.. the script u have has gettok text now stop doin that.
Wanna Talk To Me? Come At Irc #Jugo@LUNet

Anik

Quote from: Hercules on Feb 12, 2016, 12:18 PMLol why you guys taking a class of him leave him alone if you dont like his work
and your error answer
function GetTok(string, separator, n, ...)
{
 local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";
 
 if (n > tokenized.len() || n < 1) return null;
 for (; n <= m; n++)
 {
  text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
 }
 return text;
}
-_- Why DId u post? I expected him to post. Anyway, I told it bcz this board is for the snippets which u can directly use on any blank script. If you use that on any blank script u will get that error.