Sooh
Advanced User
- Joined
- Jun 26, 2014
- Messages
- 489
- Reaction score
- 25
- Age
- 31
50 Punkt?w dla 100 pierwszych zalogowanych graczy.
creaturescripts.xml> <event type="login" name="PunktyPremium" event="script" value="ppremium.lua"/>
nastepnie tworzymy plik ppremium.lua z zawartoscia:
[lua]
function onLogin(cid)
local global_storage = 6456951
local player_storage = 6456951
local max_players = 100
local premium_points = 50
if (#getPlayersByIp(getPlayerIp(cid)) >= 2) then
return true
end
if (getPlayerStorageValue(cid, player_storage) == 1) then
return true
end
if (getStorage(global_storage) >= max_players) then
return true
end
if (getGlobalStorageValue(global_storage) <= -1) then
setGlobalStorageValue(global_storage, 1)
else
setGlobalStorageValue((global_storage), getGlobalStorageValue(global_storage) +1)
end
setPlayerStorageValue(cid, player_storage, 1)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. (premium_points) .. " WHERE `id` = " .. (getPlayerAccountId(cid)))
doPlayerSendTextMessage(cid, MESSAGE_BLUE, "Congratulations! You are " .. (getGlobalStorageValue(global_storage)) .. " first logged player on the server. Your account has been recharged with " .. (premium_points) .. " premium points.")
return true
end
[/lua]
wchodzimy do login.lua i dodajemy pod koniec
registerCreatureEvent(cid, "PunktyPremium")