• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent giving xx premium points for the first xx loggers in your server

Slave Ots

LUA Newbie™
Joined
Jan 19, 2012
Messages
114
Reaction score
32
Location
/goto Slave Ots
hello otlanders
it seems that there are no such script like that
and for this request: http://otland.net/f132/script-automaticly-gives-10-premium-points-first-10-logged-players-183274// i started working
this script give premium points for the first xx numbers of players to your server,
here we go
Code:
in data / creaturescripts / scripts
create new file and name it freeloginpoints.lua

in freeloginpoints.lua ;
Code:
function onLogin(cid)
function onLogin(cid)
--authored by slave OTs____Sirion Mido's idea____for otLAnd.NeT

local free_points = 10
local players = 10 -- how much players shall it gives
local players_value = players - 1  -- dont edit this line
local pos = getPlayerPosition(cid)
local effectPositions = { -- dont edit
{x = pos.x - 5, y = pos.y - 5, z = pos.z},
{x = pos.x + 5, y = pos.y - 5, z = pos.z},
{x = pos.x + 5, y = pos.y + 5, z = pos.z},
{x = pos.x - 5, y = pos.y + 5, z = pos.z},
{x = pos.x, y = pos.y - 4, z = pos.z},
{x = pos.x, y = pos.y + 4, z = pos.z},
{x = pos.x - 4, y = pos.y, z = pos.z},
{x = pos.x + 4, y = pos.y, z = pos.z},
{x = pos.x - 4, y = pos.y - 4, z = pos.z},
{x = pos.x + 4, y = pos.y - 4, z = pos.z},
{x = pos.x + 4, y = pos.y + 4, z = pos.z},
{x = pos.x - 4, y = pos.y + 4, z = pos.z}
}
local storage_1 = 15253   --put any empty storage for counting the ten times
local storage_2 = 15251   --empty storage for players
local function doPlayerAddPremiumPoints(cid, points)
return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..points.." WHERE `id` = "..getPlayerAccountId(cid)..";")
end

------[END OF CONFIGS]-------only you need to edit the upper configs and the script will be ok
if isPlayer(cid) then
if getGlobalStorageValue(storage_1) < players_value then 
if getCreatureStorage(cid, storage_2) < 0 then
 doPlayerAddPremiumPoints(cid, free_points)
doPlayerSendTextMessage(cid, 19, 'you have been rewarded with ' .. free_points .. ' premium points. for being one of the first records here')
for _, ePos in ipairs(effectPositions) do
		doSendDistanceShoot(ePos, pos, 30)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendAnimatedText(pos, "[+10 Points]", 180)
	doSendDistanceShoot(ePos, pos, 30)
	end
	doCreatureSetStorage(cid, storage_2, 1)
setGlobalStorageValue((storage_1), getGlobalStorageValue(storage_1) +1)
end
end
end
return true
end

then in data / creaturescripts / creaturescripts.xml put
Code:
<event type="login" name="freeloginpoints" event="script" value="freeloginpoints.lua"/>

last step in data / creaturesscripts / scripts / login.lua find
Code:
registerCreatureEvent(cid, "Mail")

and add after it
Code:
registerCreatureEvent(cid, "freeloginpoints")

now reload / open server and its ready to work
hope you ppl like it
Kind Regards
Slave Ots
 
Last edited:
Don't write with red text. Don't use code tags on lua, use lua tags. Thanks for me and good work
 
it can be a lot shorter
all that function not very needed
Lua:
function onLogin(cid)
local free_points = 10 -- amount of points to add
local storage_1 = 15253   --put any empty storage for counting the ten times
local storage_2 = 15251   --empty storage for players
local rewardsplayer = 9 -- it now give for first 10 players - edit it however you want
local pos = getPlayerPosition(cid)
local function doPlayerAddPremiumPoints(cid, points)
return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..points.." WHERE `id` = "..getPlayerAccountId(cid)..";")
end
if isPlayer(cid) and getGlobalStorageValue(storage_1) < rewardsplayer and getCreatureStorage(cid, storage_2) < 0 then
doPlayerAddPremiumPoints(cid, free_points)
doPlayerSendTextMessage(cid, 19, 'you have been rewarded with ' .. free_points .. ' premium points. for being one of the first records here')
doCreatureSetStorage(cid, storage_2, 1)
setGlobalStorageValue((storage_1), getGlobalStorageValue(storage_1) +1)
end
return true
end
 
Don't write with red text. Don't use code tags on lua, use lua tags. Thanks for me and good work

okay :D thanks for advice

- - - Updated - - -

it can be a lot shorter
all that function not very needed
Lua:
function onLogin(cid)
local free_points = 10 -- amount of points to add
local storage_1 = 15253   --put any empty storage for counting the ten times
local storage_2 = 15251   --empty storage for players
local rewardsplayer = 9 -- it now give for first 10 players - edit it however you want
local pos = getPlayerPosition(cid)
local function doPlayerAddPremiumPoints(cid, points)
return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points`+"..points.." WHERE `id` = "..getPlayerAccountId(cid)..";")
end
if isPlayer(cid) and getGlobalStorageValue(storage_1) < rewardsplayer and getCreatureStorage(cid, storage_2) < 0 then
doPlayerAddPremiumPoints(cid, free_points)
doPlayerSendTextMessage(cid, 19, 'you have been rewarded with ' .. free_points .. ' premium points. for being one of the first records here')
doCreatureSetStorage(cid, storage_2, 1)
setGlobalStorageValue((storage_1), getGlobalStorageValue(storage_1) +1)
end
return true
end

it is not necessary but thanks for shourtcuting the script
 
Last edited:
anyways is bugged, i also can create 10 players with 1 account and i will get 100 points for 1 account ;)
 
Back
Top Bottom