jerryb1988
Member
- Joined
- Mar 10, 2008
- Messages
- 79
- Reaction score
- 5
RESOLVED - Admin can change this to [Release]
Credits - Me (Idea & Original Code)
Credits - Beam Da Brat (Helping fix my code)
This script will alert players when they login if there is any polls they haven't voted in. This is for TFS 3.4 and Nicaw AAC 3.21 SQL
data\creaturescripts\creaturescripts.xml
data\creaturescripts\scripts\checkpolls.lua
Credits - Me (Idea & Original Code)
Credits - Beam Da Brat (Helping fix my code)
This script will alert players when they login if there is any polls they haven't voted in. This is for TFS 3.4 and Nicaw AAC 3.21 SQL
data\creaturescripts\creaturescripts.xml
Code:
<event type="login" name="checkpolls" event="script" value="checkpolls.lua"/>
data\creaturescripts\scripts\checkpolls.lua
Code:
function onLogin(cid)
local polltable = db.getResult("SELECT COUNT(id) AS count FROM nicaw_polls");
local votetable = db.getResult("SELECT COUNT(account_id) AS count FROM nicaw_poll_votes WHERE account_id='"..getPlayerAccountId(cid).."'");
local numpolls = polltable:getDataInt("count")
local numvotes = votetable:getDataInt("count")
if(numpolls ~= numvotes) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have voted in "..numvotes.." of "..numpolls.." polls. Please vote to get rid of this message.");
end
return TRUE
end
Last edited: