• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

GlobalEvent Effect for tutors!

ghettobird

LUA newbie
Joined
Aug 17, 2013
Messages
679
Reaction score
132
Location
OTland
you can edit it if you want, i just saw it in highexp so i thought it would be nice if i share it with everyone, i'm not sure if it will work i didn't have time to test it so, just post errors if there are any !

Lua:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerGroupId(cid) ==3 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "HELPER", TEXTCOLOR_RED)
               end
         end
         return true
end

please go easy on me I'm still a beginner I'm just trying to be helpful here, also to examine myself in what i've learned/read
 
Last edited:
good work but i think u are missing end after return true
 
you can edit it if you want, i just saw it in highexp so i thought it would be nice if i share it with everyone, i'm not sure if it will work i didn't have time to test it so, just post errors if there are any !

Lua:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerGroupId(cid) == 3 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "HELPER", TEXTCOLOR_RED)
               
         end
         return true

please go easy on me I'm still a beginner I'm just trying to be helpful here, also to examine myself in what i've learned/read

- - - Updated - - -

so... any errors? is it good? :p

- - - Updated - - -

cmon guys post here... i really want to know if it's helpful :(

- - - Updated - - -

any bugs?

No need to loop through names. Fixed version:

Lua:
function onThink(interval, lastExecution)
	for k, v in pairs(getPlayersOnline()) do
		if(getPlayerGroupId(v) == 3) then
			doSendMagicEffect(getPlayerPosition(v), CONST_ME_GIFT_WRAPS)
			doSendAnimatedText(getPlayerPosition(v), "Tutor", TEXTCOLOR_RED)
		end
	end
	return true
end
 
yup.mega is right you are missing a end(you ended *if*.but you didn't end the function)
 
First of all, This script would not load because you are missing 2 ends.

Secondly, you did not need to use the "getPlayerByName(name)" function.

Here is your script fixed with notes:
Lua:
function onThink(interval, lastExecution)
	for _, pid in ipairs(getOnlinePlayers()) do -- Changed name to pid (You don't have to, but it's just how I do things)
		-- local cid = getPlayerByName(name) Deleted this line because it is not needed
		if getPlayerGroupId(pid) == 3 then
			doSendMagicEffect(getPlayerPosition(pid), 27)
			doSendAnimatedText(getPlayerPosition(pid), "HELPER", TEXTCOLOR_RED)
		end
	end
	return true
end
 
Btw you can just make Offical Ghetto Scripts :) and keep on posting there
 
i download uniserv today, i fixed this script, NOW IT WORKS 100%!

Lua:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerGroupId(cid) ==3 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "HELPER", TEXTCOLOR_RED)
               end
         end
         return true
end
 
@Teckman
You beat me to it!

@ghettobird
You still have that getPlayerByName(name)!
Also you may want to note that this script only works correctly for clients below 9.2 I think (doSendAnimatedText is disabled in newer clients)
 
you can edit it if you want, i just saw it in highexp so i thought it would be nice if i share it with everyone, i'm not sure if it will work i didn't have time to test it so, just post errors if there are any !

Lua:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerGroupId(cid) ==3 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "HELPER", TEXTCOLOR_RED)
               end
         end
         return true
end

please go easy on me I'm still a beginner I'm just trying to be helpful here, also to examine myself in what i've learned/read

its a great idea! but its now all the time spamming helper, in my opinion its better to let the tutors chose when they have it on or off with a talkaction :)

it would be nice if you did this for "most powerfull guild" that it says like "Leading Guild" all the time at the players that is in the guild with the most frags
 
you can choose the time, once every 2.5 seconds or once every 5 seconds, etc... :p

it would be nice if you did this for "most powerfull guild" that it says like "Leading Guild" all the time at the players that is in the guild with the most frags
 
Back
Top