Skrypty & Kody Problem ze skryptem

Status
Zamknięty.

vexler222

Advanced User
Zarejestrowany
Dołączył
Luty 12, 2012
Posty
337
Liczba reakcji
11
Witam, mam taki skrypt na zamiane cc w gn i odwrotnie

Kod:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 2160 and item.type == 100 then
doRemoveItem(item.uid,item.type)
doPlayerAddItem(cid,2157,1)
doPlayerSendTextMessage(cid,22,"$$$")
elseif item.itemid == 2160 and item.type < 100 then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid,2152,100)
doPlayerSendTextMessage(cid,22,"$$$")
end
end

Tutaj aktualnie zamienia cc w gn ale nie zamienia? gn w cc wi?c doda?em kolejne linijki i mam problem, ?e teraz zamieni 1gn w 100cc ale ju? 100cc w 1gn nie chce ;/ Do tego gdy mamy np. 100gn nie zamieni je w cc trzeba rozdzieli? pierw na 1gn i dopiero.

Kod:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 2157 and item.type == 1 then
doRemoveItem(item.uid,item.type)
doPlayerAddItem(cid,2160,100)
doPlayerSendTextMessage(cid,22,"$$$")
if item.itemid == 2160 and item.type == 100 then
doRemoveItem(item.uid,item.type)
doPlayerAddItem(cid,2157,1)
doPlayerSendTextMessage(cid,22,"$$$")
elseif item.itemid == 2160 and item.type < 100 then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid,2152,100)
doPlayerSendTextMessage(cid,22,"$$$")
end
end 
end

---------- Tre?? dodana o 11:13 ----------

ref

---------- Tre?? dodana o 13:30 ----------

ref
 
Odp: Problem ze skryptem

UP, jak by si? da?o to bym zrobi? ... Patrzy?em jak wygl?da gp czy cc da?em to samo gn i nic wi?c sko?cz ju? tak pisa? lub powiedz jak skoro si? da ... A jak by si? da?o w items.xml to po co by mia? by? ten skrypt changegold w paczce z silnikiem>

---------- Tre?? dodana o 21:03 ----------

ref

---------- Tre?? dodana o 01:21 ----------

ref

---------- Tre?? dodana o 10:44 ----------

ref
 
Odp: Problem ze skryptem

No masz w silniku skrypt na zamiane doda? tylko, ?e z cc na gn tylko trzeba pomy?le? troch?, bo jak wpiszesz tam nazw? to i do lib trzeba ale mo?na przecie? id od razu, ?eby si? nie pierdzeli?:
[LUA]local coins = {
[ITEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[ITEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_TEAL
}
[Wpisz id tego itemka gn tutaj] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_TEAL
}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end

local coin = coins[item.itemid]
if(not coin) then
return false
end

if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, coin.to, 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
end
return true
end[/LUA]
i powinno trybi?.
 
Ostatnia edycja:
Odp: Problem ze skryptem

Up, tw?j skrypt zamienia gn na cc ale odwrotnie nie. I nie chodzi o to bo tak mia?em zrobione chodzi o to, ?e na tym skrypcie znikaj? gp itp gdy si? ma full bp a nie wylatuj? pod gracza

---------- Tre?? dodana o 17:05 ----------

ref

---------- Tre?? dodana o 20:43 ----------

ref
 
Odp: Problem ze skryptem

ref

---------- Tre?? dodana o 21:34 ----------

Zrobi?em co? takiego ala jak pan up m?wi?

Kod:
local coins = {
	[ITEM_GOLD_COIN] = {
		to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
	},
	[ITEM_PLATINUM_COIN] = {
		from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
	},
	[ITEM_CRYSTAL_COIN] = {
		from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_TEAL
	}
	[ITEM_GOLD_NUGGET] = {
		from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_YELLOW
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
		return false
	end

	local coin = coins[item.itemid]
	if(not coin) then
		return false
	end

	if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, coin.to, 1)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
	elseif(coin.from ~= nil) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return true
end

Ale wywala mi b??dy i za choler? nie wiem o co z nimi chodzi.



Kod:
[16/11/2015 21:24:01] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:01] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)
[16/11/2015 21:24:01] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:01] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:01] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)
[16/11/2015 21:24:01] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:01] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:01] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)
[16/11/2015 21:24:01] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:01] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:02] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)
[16/11/2015 21:24:02] data/actions/scripts/other/changegold.lua:11: '}' expected (to close '{' at line 1) near '['
[16/11/2015 21:24:02] Reloaded actions.
 
Odp: Problem ze skryptem

[LUA]local coins = {
[ITEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[ITEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_TEAL
},
[ITEM_GOLD_NUGGET] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_YELLOW
}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end

local coin = coins[item.itemid]
if(not coin) then
return false
end

if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, coin.to, 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
elseif(coin.from ~= nil) then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
end
return true
end [/LUA]
A jak nie to spr?buj ten kod.


[LUA] wklej.to/RJjBS [/LUA]
 
Ostatnia edycja:
Odp: Problem ze skryptem

1. skrypt

Kod:
[17/11/2015 12:58:38] [Error - Action Interface] 
[17/11/2015 12:58:38] data/actions/scripts/other/changegold.lua
[17/11/2015 12:58:38] Description: 
[17/11/2015 12:58:38] data/actions/scripts/other/changegold.lua:13: table index is nil
[17/11/2015 12:58:38] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/changegold.lua)


i w drugim to samo ;/

---------- Tre?? dodana o 15:32 ----------

//edit znalaz?em co? innego i dzia?a tylko problem jest taki, ?e nie da si? zamieni? 100 GN na cc dopiero gdy mamy 99 GN mo?emy zamieni? na cc ;/


crystal.lua

[lua]function onUse(cid, item, frompos, item2, topos)
if item.itemid == 2160 and item.type == 100 then
doRemoveItem(item.uid,item.type)
doPlayerAddItem(cid,2157,1)
doPlayerSendTextMessage(cid,22,"Grube hajsy widze :*")
elseif item.itemid == 2160 and item.type < 100 then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid,2152,100)
doPlayerSendTextMessage(cid,22,"Grube hajsy widze :*")
end
end [/lua]

nugget.lua

[lua]function onUse(cid, item, frompos, item2, topos)
if item.itemid == 2157 and item.type < 100 then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid,2160,100)
doPlayerSendTextMessage(cid,22,"Grube hajsy widze :*")
end
end
[/lua]

changegold.lua

[lua]local coins = {
[ITEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[ITEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_TEAL
}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end

local coin = coins[item.itemid]
if(not coin) then
return false
end

if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, coin.to, 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
end

return true
end[/lua]

---------- Tre?? dodana o 19:24 ----------

:???

---------- Tre?? dodana o 20:25 ----------

Dobra mo?na zamkn?? poradzi?em sobie :*
 
Status
Zamknięty.
Back
Do góry