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

Lua Just started scripting need some directions!

FakkaHe

New Member
Joined
Feb 2, 2008
Messages
110
Reaction score
0
Hello fellow otlanders! i just started scriping i was reading a guide for lua scripting.

I think i got this script right i was trying to teleport the player to the temple IF they don't have white, red, black skull.

It it would cost 20000 gold coins

Thanks before hand!


(Please i've just started scripting pleae be kind ^^)




Code:
-- Created using QtLuaPad on to jun 16 2011
-- Written by: FakkaHe

function onSay(cid, words, param)
    if getPlayerSkullTicks(cid, 1)
    else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
end
	if getPlayerSkullTicks(cid, 2)
	else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
end
	if getPlayerSkullTicks(cid, 3)
	else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
end	
	if doRemoveItem(2160[, 2])
	doTeleportThing(cid, 1003,1000,7[, pushmove = true])
	else
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You need 2 crystal coins to use the teleport!)
	return TRUE
end
 
What is QTLuaPad?

I would suggest using notepad++ if you want to write more scripts. This looks ok for a first try. I don't know the exact function for skull checking but I think it can also be something like this:

Code:
if getPlayerSkullTicks(cid) > 0

that would safe you much lines if you can use this function this way.

Keep up the good work;)
 
Code:
-- Written by Xerazx --

local temple = {x = 95, y = 117, z = 7}
function onSay(cid, words, param)
    if getCreatureSkullType(cid) < 1 then
        if doPlayerRemoveMoney(cid, 20000) then
            doTeleportThing(cid, temple)
            doSendMagicEffect(temple, CONST_ME_TELEPORT)
        else
            doPlayerSendCancel(cid, "srry you don't have enough money")
        end
    else
        doPlayerSendCancel(cid, "XXXXXXXXXXXX")
    end
    return true
end
 
use elseif :s


Should i remove all those end?

Code:
-- Created using QtLuaPad on to jun 16 2011
-- Written by: FakkaHe

function onSay(cid, words, param)
		if getPlayerSkullTicks(cid, 1)
    elseif doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
		if getPlayerSkullTicks(cid, 2)
	elseif doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
		if getPlayerSkullTicks(cid, 3)
	elseif doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
		doRemoveItem(2160[, 2])
		doTeleportThing(cid, 1003,1000,7[, pushmove = true])
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You need 2 crystal coins to use the teleport!)
	return TRUE
end

Would something like this work?
 
if getPlayerSkullTicks(cid, 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, You can't have white,red,black skull to use this teleport system)
elseif
getPlayerSkullTicks(cid, 3) then
it's an example :p
 
Back
Top