King Simon
Learning Lua
- Joined
- Jul 29, 2013
- Messages
- 16
- Reaction score
- 3
Hey Guys i recently started scripting and this is my second script so far. Basically when you say !joke it will send a joke.
Rep ++ if i helped
In talkactions.xml add this line
then add a new file in talkactions/scripts and name it Jokes.lua
inside add this code :
You can add ur own jokes in the lines
I also made this a globalevent for anyone who doesn't like the talkaction
in globalevents.xml add:
change the interval to how often you want it to display.
then in globalevents/scripts add a new file called Jokes.lua
in this file add this code:
to add jokes just do the same thing as the talk action, and ur good to go
I tested this on tfs 0.3.6 and im not sure how any other distros work so if anyone has problems just post them here and hopefully someone can help you
Rep ++ if i helped
Rep ++ if i helped
In talkactions.xml add this line
XML:
<talkaction words="!joke" event="script" value="Jokes.lua"/>
then add a new file in talkactions/scripts and name it Jokes.lua
inside add this code :
Lua:
local jokes = {
"I swear to drunk I'm not God, but seriously, stay in drugs, eat school, and don't do vegetables.",
"I named my hard drive 'dat ass' so once a month my computer asks if I want to 'back dat ass up'.",
"If a guy remembers the color of your eyes after the first date, chances are... you have small boobs.",
"Relationships are a lot like algebra. Have you ever looked at your X and wondered Y?",
"why do midgets laugh while running through the yard? The grass tickles their nuts",
"I hate when I am about to hug someone really sexy and my face hits the mirror.",
"If you force sex on a prostitute is it rape or shoplifting?",
"Scooters are for men who want to ride motorcycles, but prefer to feel the wind on their vaginas.",
"I was at a restaurant and I noticed my waitress had a black eye. So I ordered very sloooowly because obviously she doesn't listen.",
"Every time someone calls me fat I get so depress I cut myself... a piece of cake.",
"Dear Santa,I've been good all year. Okay most of the time. Once in awhile...F*ck it I'll buy my own shit.",
"A big shout out to sidewalks... Thanks for keeping me off the streets.",
"you're a boob. just tittin. you're my breast friend.",
"Sex is not the answer. Sex is the question. 'Yes' is the answer.",
"Never give up on your dreams. Keep sleeping.",
"When I woke up today, I had no plans to be awesome but hey, shit happens.",
}
local i = #jokes --- number of Jokes
function onSay(cid, words, param)
doPlayerSendTextMessage(cid, 6, jokes[math.random(1,i)])
end
You can add ur own jokes in the lines
I also made this a globalevent for anyone who doesn't like the talkaction
in globalevents.xml add:
XML:
<globalevent name="Jokes" interval="1000" script="Jokes.lua"/>
change the interval to how often you want it to display.
then in globalevents/scripts add a new file called Jokes.lua
in this file add this code:
Lua:
local jokes = {
"I swear to drunk I'm not God, but seriously, stay in drugs, eat school, and don't do vegetables.",
"I named my hard drive 'dat ass' so once a month my computer asks if I want to 'back dat ass up'.",
"If a guy remembers the color of your eyes after the first date, chances are... you have small boobs.",
"Relationships are a lot like algebra. Have you ever looked at your X and wondered Y?",
"why do midgets laugh while running through the yard? The grass tickles their nuts",
"I hate when I am about to hug someone really sexy and my face hits the mirror.",
"If you force sex on a prostitute is it rape or shoplifting?",
"Scooters are for men who want to ride motorcycles, but prefer to feel the wind on their vaginas.",
"I was at a restaurant and I noticed my waitress had a black eye. So I ordered very sloooowly because obviously she doesn't listen.",
"Every time someone calls me fat I get so depress I cut myself... a piece of cake.",
"Dear Santa,I've been good all year. Okay most of the time. Once in awhile...F*ck it I'll buy my own shit.",
"A big shout out to sidewalks... Thanks for keeping me off the streets.",
"you're a boob. just tittin. you're my breast friend.",
"Sex is not the answer. Sex is the question. 'Yes' is the answer.",
"Never give up on your dreams. Keep sleeping.",
"When I woke up today, I had no plans to be awesome but hey, shit happens.",
}
local i = #jokes --- number of Jokes
function onThink(cid, interval, lastExecution)
doBroadcastMessage("Joke: " .. jokes[math.random(1,i)],22)
return TRUE
end
to add jokes just do the same thing as the talk action, and ur good to go
I tested this on tfs 0.3.6 and im not sure how any other distros work so if anyone has problems just post them here and hopefully someone can help you
Rep ++ if i helped
Last edited: