• 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!

I need voting system talk action i give u rep++ f u help me!!

Okey here it is.
pollsystem.lua
LUA:
local ActiveValue = 666
local YesValue = 1000
local NoValue = 2000
local ExhaustTime = 6000000 --- Time (in minutes) that the player will have to wait 'till he can vote again Default = 10min
local AutoEnd = true ---Use Auto End (set true or false)
local ToEnd = 1000*60*10 -- Time to auto-end poll (in miliseconds) Default = 10min
local WriteBook = false --- Write a book with the results (true or false)

function onSay(cid, words, param)
if words == '!makepoll' then 
if getPlayerAccess(cid) >= 3 then
if getGlobalStorageValue(ActiveValue) ~= 1 then
if param ~= nil then
doPlayerSay(cid,'Poll: '..param..'',9)
setGlobalStorageValue(YesValue,0)
setGlobalStorageValue(NoValue,0)
setGlobalStorageValue(ActiveValue,1)
if AutoEnd == true then
addEvent(EndPoll,ToEnd,cid)
end
end
else
doPlayerSendTextMessage(cid,22,'A poll is already running.')
end
else
doPlayerSendCancel(cid,'Only Gamemasters can make a poll')
end
elseif words == '!vote' and getGlobalStorageValue(ActiveValue) == 1 and exhaust(cid,500,ExhaustTime) == 1 then
if param == 'yes' then
setGlobalStorageValue(YesValue,getGlobalStorageValue(YesValue)+1)
doPlayerSendTextMessage(cid,22,'Thanks for your vote.')
elseif param == 'no' then
setGlobalStorageValue(NoValue,getGlobalStorageValue(NoValue)+1)
doPlayerSendTextMessage(cid,22,'Thanks for your vote.')
else
doPlayerSendTextMessage(cid,22,'Use only !vote "yes or !vote "no.')
end 
elseif words == '!endpoll' then
if getPlayerAccess(cid) >= 3 then
if getGlobalStorageValue(ActiveValue) == 1 then
setGlobalStorageValue(ActiveValue,2)
doSetItemText(doPlayerAddItem(cid,1984,1),'The results are: Yes: '..getGlobalStorageValue(YesValue)..', No: '..getGlobalStorageValue(NoValue)..'')
doPlayerSay(cid,'The poll has ended, thanks for your votes.',9)
else
doPlayerSendCancel(cid,'There is no poll running.')
end
else
doPlayerSendCancel(cid,'Only Gamemasters can end polls')
end
end
end

function EndPoll(cid)
if getGlobalStorageValue(ActiveValue) == 1 then
setGlobalStorageValue(ActiveValue,2)
doPlayerSay(cid,'The poll has ended, thanks for your votes.',9)
if WriteBook == true then
doSetItemText(doPlayerAddItem(cid,1984,1),'The results are: Yes: '..getGlobalStorageValue(YesValue)..', No: '..getGlobalStorageValue(NoValue)..'')
end
print('The results are: Yes = '..getGlobalStorageValue(YesValue)..', No = '..getGlobalStorageValue(NoValue)..'')
else
print('No polls running')
end
end

PHP:
<talkaction words="!makepoll" script="pollsystem.lua" />
<talkaction words="!vote" script="pollsystem.lua" />
<talkaction words="!endpoll" script="pollsysetm.lua" />

How to use?
!makepoll "Here you question - Command to start a poll.
!vote "yes - Vote yes.
!vote "no - Vote no.
!endpoll - Command to end poll.

When you do !endpoll, a blue book will be added to GM's backpack with the results of the poll.
 
Yes, only gamemasters.. Do you want everyone can make poll?
LUA:
local ActiveValue = 666
local YesValue = 1000
local NoValue = 2000
local ExhaustTime = 6000000 --- Time (in minutes) that the player will have to wait 'till he can vote again Default = 10min
local AutoEnd = true ---Use Auto End (set true or false)
local ToEnd = 1000*60*10 -- Time to auto-end poll (in miliseconds) Default = 10min
local WriteBook = false --- Write a book with the results (true or false)

function onSay(cid, words, param)
if words == '!makepoll' then 
if getPlayerAccess(cid) >= 1 then
if getGlobalStorageValue(ActiveValue) ~= 1 then
if param ~= nil then
doPlayerSay(cid,'Poll: '..param..'',9)
setGlobalStorageValue(YesValue,0)
setGlobalStorageValue(NoValue,0)
setGlobalStorageValue(ActiveValue,1)
if AutoEnd == true then
addEvent(EndPoll,ToEnd,cid)
end
end
else
doPlayerSendTextMessage(cid,22,'A poll is already running.')
end
else
doPlayerSendCancel(cid,'Only Gamemasters can make a poll')
end
elseif words == '!vote' and getGlobalStorageValue(ActiveValue) == 1 and exhaust(cid,500,ExhaustTime) == 1 then
if param == 'yes' then
setGlobalStorageValue(YesValue,getGlobalStorageValue(YesValue)+1)
doPlayerSendTextMessage(cid,22,'Thanks for your vote.')
elseif param == 'no' then
setGlobalStorageValue(NoValue,getGlobalStorageValue(NoValue)+1)
doPlayerSendTextMessage(cid,22,'Thanks for your vote.')
else
doPlayerSendTextMessage(cid,22,'Use only !vote "yes or !vote "no.')
end 
elseif words == '!endpoll' then
if getPlayerAccess(cid) >= 3 then
if getGlobalStorageValue(ActiveValue) == 1 then
setGlobalStorageValue(ActiveValue,2)
doSetItemText(doPlayerAddItem(cid,1984,1),'The results are: Yes: '..getGlobalStorageValue(YesValue)..', No: '..getGlobalStorageValue(NoValue)..'')
doPlayerSay(cid,'The poll has ended, thanks for your votes.',9)
else
doPlayerSendCancel(cid,'There is no poll running.')
end
else
doPlayerSendCancel(cid,'Only Gamemasters can end polls')
end
end
end

function EndPoll(cid)
if getGlobalStorageValue(ActiveValue) == 1 then
setGlobalStorageValue(ActiveValue,2)
doPlayerSay(cid,'The poll has ended, thanks for your votes.',9)
if WriteBook == true then
doSetItemText(doPlayerAddItem(cid,1984,1),'The results are: Yes: '..getGlobalStorageValue(YesValue)..', No: '..getGlobalStorageValue(NoValue)..'')
end
print('The results are: Yes = '..getGlobalStorageValue(YesValue)..', No = '..getGlobalStorageValue(NoValue)..'')
else
print('No polls running')
end
end
 
LUA:
local ActiveValue = 666
local YesValue = 1000
local NoValue = 2000
local ExhaustTime = 6000000 --- Time (in minutes) that the player will have to wait 'till he can vote again Default = 10min
local AutoEnd = true ---Use Auto End (set true or false)
local ToEnd = 1000*60*10 -- Time to auto-end poll (in miliseconds) Default = 10min
local WriteBook = false --- Write a book with the results (true or false)

function onSay(cid, words, param)
if words == '!makepoll' then 
if getPlayerAccess(cid) >= 5 then
if getGlobalStorageValue(ActiveValue) ~= 1 then
if param ~= nil then
doPlayerSay(cid,'Poll: '..param..'',9)
setGlobalStorageValue(YesValue,0)
setGlobalStorageValue(NoValue,0)
setGlobalStorageValue(ActiveValue,1)
if AutoEnd == true then
addEvent(EndPoll,ToEnd,cid)
end
end
else
doPlayerSendTextMessage(cid,22,'A poll is already running.')
end
else
doPlayerSendCancel(cid,'Only Gamemasters can make a poll')
end
elseif words == '!vote' and getGlobalStorageValue(ActiveValue) == 1 and exhaust(cid,500,ExhaustTime) == 1 then
if param == 'yes' then
setGlobalStorageValue(YesValue,getGlobalStorageValue(YesValue)+1)
doPlayerSendTextMessage(cid,22,'Thanks for your vote.')
elseif param == 'no' then
setGlobalStorageValue(NoValue,getGlobalStorageValue(NoValue)+1)
doPlayerSendTextMessage(cid,22,'Thanks for your vote.')
else
doPlayerSendTextMessage(cid,22,'Use only !vote "yes or !vote "no.')
end 
elseif words == '!endpoll' then
if getPlayerAccess(cid) >= 3 then
if getGlobalStorageValue(ActiveValue) == 1 then
setGlobalStorageValue(ActiveValue,2)
doSetItemText(doPlayerAddItem(cid,1984,1),'The results are: Yes: '..getGlobalStorageValue(YesValue)..', No: '..getGlobalStorageValue(NoValue)..'')
doPlayerSay(cid,'The poll has ended, thanks for your votes.',9)
else
doPlayerSendCancel(cid,'There is no poll running.')
end
else
doPlayerSendCancel(cid,'Only Gamemasters can end polls')
end
end
end

function EndPoll(cid)
if getGlobalStorageValue(ActiveValue) == 1 then
setGlobalStorageValue(ActiveValue,2)
doPlayerSay(cid,'The poll has ended, thanks for your votes.',9)
if WriteBook == true then
doSetItemText(doPlayerAddItem(cid,1984,1),'The results are: Yes: '..getGlobalStorageValue(YesValue)..', No: '..getGlobalStorageValue(NoValue)..'')
end
print('The results are: Yes = '..getGlobalStorageValue(YesValue)..', No = '..getGlobalStorageValue(NoValue)..'')
else
print('No polls running')
end
end
Just edit here:
LUA:
if getPlayerAccess(cid) >= 5 then
Change the number 5 for the access of your god.
 
[12/05/2009 04:46:35] Warning: [Event::loadScript] Can not load script. data/talkactions/scripts/pollsysetm.lua
[12/05/2009 04:46:35] cannot open data/talkactions/scripts/pollsysetm.lua: No such file or directory

You wrote "pollsysetm.lua"... please learn to read...

The error says: "NO SUCH FILE OR DIRECTORY".... :huh:
 
problem

hey i get the same problem

[07/06/2009 20:07:24] Warning: [Event::loadScript] Can not load script. data/talkactions/scripts/pollsysetm.lua
[07/06/2009 20:07:24] cannot open data/talkactions/scripts/pollsysetm.lua: No such file or directory

I change the name but it still wrong what i need to do?
 
Back
Top