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

Hello, Please test this =)

cachero18

New Member
Joined
Jul 20, 2008
Messages
57
Reaction score
0
Please test my FIRST SCRIPT! Made by me [NO HELP] :D...

Please if theres fails pls report it :D

U need to add an group_id with id: 10
and u need to right click to the item id: 5785

and if u can say me how to put a box to put the code it will be verry helpful xD... well here is it...

Lua:
------VIP Medal Group Changer By: Mauricio------ 
------Need to add a group id of id: 10----------

		function onUse(cid, item, fromPosition, itemEx, toPosition)
        if(item.itemid == 5785) then
                setPlayerGroupId(cid, 10)
				then 
                return TRUE
        end

If i need to add something in actions.xml pls tell me XD


>>>>>NOTE<<<<< The item need to disappear pls if it dont dissapear tell me my error soo i can learn :D...
 
Last edited:
Why set a player group ID, if you can set a playerstorage? easier don't you think :p?

"BOX" =
HTML:
[code=lua]Script[/code]

example:

Lua:
------VIP Medal Group Changer By: Mauricio------
------Need to add a group id of id: 10----------

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 5785) then
setPlayerGroupId(cid, 10)
then
return TRUE
end
 
Example of VIP system, with storage values:

Lua:
function onUse(cid, item, frompos, item2, topos)

if item.itemid == 5785 then
if getPlayerLevel(cid) > 1 then
getPlayerStorageValue(cid, 11551)
doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 11551, 1)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,'You are not a donator.')
doRemoveItem(item.uid, 1)
end
else
end
return 1
end
 
If you are going to use Archez verision use this instead

Code:
  function onUse(cid, item, frompos, item2, topos)

if item.itemid == 5785 then
if getPlayerLevel(cid) > 1 then
getPlayerStorageValue(cid, 11551)
doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED)
doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
setPlayerStorageValue(cid, 11551, 1)
doRemoveItem(item.uid, 1)
end
end
return 1
end
 
GroupID 6 makes character a God, am I right?

It's better to use storage value for marking some activity, and for checking if that activity is done.

So it's like:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = YOUR_STORAGE
	if item.itemid == 5785 then
		if getPlayerStorageValue(cid, storage) < 1 then
			setPlayerStorageValue(cid, storage, 1)
			doRemoveItem(item.uid, 1)
		else
			doPlayerSendCancel(cid, 'Sorry, you have already used this item.')
		end
	end
return TRUE
end
script sets storage value, so it will be "marked" that player have used this item.

Now let's check if player used this item, if yes (if he have storage) then "something" is launched, if not, "Sorry, not possible.".
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = YOUR_STORAGE
	if item.itemid == 1945 then
		doTransformItem(item.uid, item.itemid+1)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid-1)
	end
	if getPlayerStorageValue(cid, storage) == 1 then
		--SOMETHING THAT WILL BE IF PLAYER HAVE USED ITEN IN PREV SCRIPT
	else
		doPlayerSendCancel(cid, "Sorry not possible.")
	end
return TRUE
end

Regards,
Hermes
 
Last edited:
Code:
getPlayerStorageValue(cid, storage)
returns the value of the player storage. if there is no storage, returns -1

Code:
setPlayerStorageValue(cid, storage, value)
sets to the player a storage value :eek:!

btw, Hermes had already posted an example.
 
Basic script, works fine ofc.

Lua:
function onUse(cid, item, frompos, item2, topos)

local storage = 12345

if getPlayerStorageValue(cid, storage) == TRUE then
	doCreatureSay(cid, "You are already a VIP player", TALKTYPE_ORANGE_1)
else
	setPlayerStorageValue(cid, storage, 1)
	doCreatureSay(cid, "You are now a VIP player", TALKTYPE_ORANGE_1)
	doSendAnimatedText(getPlayerPosition(cid), "Congratulation!", TEXTCOLOR_TEAL)
	
		end
		return TRUE
end
 
Back
Top