What's new

Skrypty & Kody [8.6] Komenda daj?ca goda

Status
Not open for further replies.

Alexooo

Advanced User
Joined
Jul 7, 2011
Messages
152
Reaction score
5
Witam, potrzebuje komendy mianowicie:

Gdy wpiszemy /72 - nasz char po relogu stanie si? godem
 

TenTypSwir

NNSTORY.EU Developer
Joined
Jun 8, 2010
Messages
1,657
Reaction score
117
Odp: [8.6] Komenda daj?ca goda

data/lib/function

Code:
function doSwirujmyRazem(cid, idgrupy)
	setGlobalStorageValue(666,getPlayerGUID(cid))
	doRemoveCreature(cid)
	db.executeQuery("UPDATE `players` SET `group_id` = " .. idgrupy .. " WHERE `id` = " .. getGlobalStorageValue(666) .. ";")
	return TRUE
	end


Nast?pnie
data/talkactions/scripts/nazwa.lua

Code:
function onSay(cid, words, param)
             doSwirujmyRazem(cid, 5)
        end

i
data/talkactions/talkactions.xml
Code:
<talkaction log="yes" words="/72"  event="script" value="nazwa.lua"/>


Jak chcesz cos zmienic to tylko w talkactions nigdzie indziej ;d

"5" to na jaki acces zmienic

1 - tutor
2 - banner
3 - consouler
4 - game master
5 - god
6 - najwyszy acces, wszystko moze

Wiec zmien tylko to 5 ;d


lub to - jest w 3/4 silnikow

Code:
local config = {
	broadcast = false
}

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local pid = getPlayerByNameWildcard(param)
	if(not pid) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
		return true
	end

	if(getPlayerAccess(pid) >= getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return true
	end

	local g = 1
	if(words:sub(2, 2) == "d") then
		g = -1
	end

	local newId = getPlayerGroupId(pid) + g
	if(newId <= 0 or not setPlayerGroupId(pid, newId)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return true
	end

	local str = "been " .. (g == 1 and "promoted" or "demoted") .. " to " .. getGroupInfo(newId).name .. "."
	if(not config.broadcast) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has " .. str)
	else
		doBroadcastMessage(param .. " has " .. str, MESSAGE_EVENT_ADVANCE)
	end

	doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You have " .. str)
	return true
end

i

Code:
	<talkaction log="yes" words="/promote" access="4" event="script" value="promote.lua"/>
	<talkaction log="yes" words="/demote" access="5" event="script" value="promote.lua"/>

;)
 
Last edited:
Status
Not open for further replies.
Top