WikiArk21
New Member
- Joined
- Oct 24, 2023
- Messages
- 14
- Reaction score
- 1
this script is pointing out this error. Does anyone know how to solve the problem?
this is the script:
this is the erro
this is the script:
function onStepIn(cid, item, position, fromPosition)
if not isPlayer(cid) then
return false
end
local playerPosition = getCreaturePosition(cid)
local vocation = getPlayerVocation(cid)
-- Defina as habilidades correspondentes para cada vocação
local skillsToTrain = {
[0] = {6},
[1] = {6},
[2] = {6},
[3] = {6},
[4] = {6},
[5] = {6},
[6] = {6},
[7] = {6},
[8] = {6},
[9] = {6},
[10] = {6},
[11] = {6},
[12] = {6},
[13] = {6},
[14] = {6},
[15] = {6},
[16] = {6},
[17] = {6},
[18] = {6},
[19] = {6},
[20] = {6},
[21] = {6},
[22] = {6},
[23] = {6},
[24] = {6},
[25] = {6},
[26] = {6},
[27] = {6},
[28] = {6},
[29] = {6},
[30] = {6},
[31] = {6},
[32] = {6},
[33] = {6},
[34] = {6},
[35] = {6},
[36] = {6},
[37] = {6},
[38] = {6},
[39] = {6},
[40] = {6},
[41] = {6},
[42] = {6},
[43] = {6},
[44] = {6},
[45] = {6},
[46] = {6},
[47] = {6},
[48] = {6},
[49] = {6},
[50] = {6},
[51] = {6},
[52] = {6},
[53] = {6},
[54] = {6},
[55] = {6},
[56] = {6},
[57] = {6},
[58] = {6},
[59] = {6},
[60] = {6},
[61] = {6},
[62] = {6},
[63] = {6},
[64] = {6},
[65] = {6},
[66] = {6},
[67] = {6},
[68] = {6},
[69] = {6},
[70] = {6},
[71] = {6},
[72] = {6},
[73] = {6},
[74] = {6},
[75] = {6},
[76] = {6},
[77] = {6},
[78] = {6},
[79] = {6},
[80] = {6},
[81] = {6},
[82] = {6},
[83] = {6},
[84] = {6},
[85] = {6},
[86] = {6},
[87] = {6},
[88] = {6},
[89] = {6},
[90] = {6},
[91] = {6},
[92] = {6},
[93] = {6},
[94] = {6},
[95] = {6},
[96] = {6},
[97] = {6},
[98] = {6},
[99] = {6},
[100] = {6},
[101] = {6},
[102] = {6},
[103] = {6},
[104] = {6},
[105] = {6},
[106] = {6},
[107] = {6},
[108] = {6},
[109] = {6},
[110] = {6},
[111] = {6},
[112] = {6},
[113] = {6},
[114] = {6},
[115] = {6},
[116] = {6},
[117] = {6},
[118] = {6},
[119] = {6},
[120] = {6},
[121] = {6},
[122] = {6},
[123] = {6},
[124] = {6},
[125] = {6},
[126] = {6},
[127] = {6},
[128] = {6},
[129] = {6},
[130] = {6},
[131] = {6},
[132] = {6},
[133] = {6},
[134] = {6},
[135] = {6},
[136] = {6},
[137] = {6},
[138] = {6},
[139] = {6},
[140] = {6},
[141] = {6},
[142] = {6},
[143] = {6},
[144] = {6},
[145] = {6},
[146] = {6},
[147] = {6},
[148] = {6},
[149] = {6},
[150] = {6},
[151] = {6},
[152] = {6},
[153] = {6},
[154] = {6},
[155] = {6},
[156] = {6},
[157] = {6},
[158] = {6},
[159] = {6},
[160] = {6},
[161] = {6},
[162] = {6},
[163] = {6},
[164] = {6},
[165] = {6},
[166] = {6},
[167] = {6},
[168] = {6},
[169] = {6},
[170] = {6},
[171] = {6},
[172] = {6},
[173] = {6},
[174] = {6},
[175] = {6},
[176] = {6},
[177] = {6},
[178] = {6},
[179] = {6},
[180] = {6},
[181] = {6},
[182] = {6},
[183] = {6},
[184] = {6},
[185] = {6},
[186] = {6},
[187] = {6},
[188] = {6},
[189] = {6},
[190] = {6},
[191] = {6},
[192] = {6},
[193] = {6},
[194] = {6},
[195] = {6},
[196] = {6},
[197] = {6},
[198] = {6},
[199] = {6},
[200] = {6},
[201] = {6},
[202] = {6},
[203] = {6},
[204] = {6},
[205] = {6},
[206] = {6},
[207] = {6},
[208] = {6},
[209] = {6},
[210] = {6},
[211] = {6},
[212] = {6},
[213] = {6},
[214] = {6},
[215] = {6},
[216] = {6},
[217] = {6},
[218] = {6},
[219] = {6},
[220] = {6},
[221] = {6},
[222] = {6},
[223] = {6},
[224] = {6},
[225] = {6},
[226] = {6},
[227] = {6},
[228] = {6},
[229] = {6},
[230] = {6},
[231] = {6},
[232] = {6},
[233] = {6},
[234] = {6},
[235] = {6},
[236] = {6},
[237] = {6},
[238] = {6},
[239] = {6},
[240] = {6},
[241] = {6},
[242] = {6},
[243] = {6},
[244] = {6},
[245] = {6},
[246] = {6},
[247] = {6},
[248] = {6},
[249] = {6},
[250] = {6},
[251] = {6},
[252] = {6},
[253] = {6},
[254] = {6},
[255] = {6},
[256] = {6},
[257] = {6},
[258] = {6},
[259] = {6},
[260] = {6},
[261] = {6},
[262] = {6},
[263] = {6},
[264] = {6},
[265] = {6},
[266] = {6},
[267] = {6},
[268] = {6},
[269] = {6},
[270] = {6},
[271] = {6},
[272] = {6},
[273] = {6},
[274] = {6},
[275] = {6},
[276] = {6},
[277] = {6},
[278] = {6},
[279] = {6},
[280] = {6},
[281] = {6},
[282] = {6},
[283] = {6},
[284] = {6},
[285] = {6},
[286] = {6},
[287] = {6},
[288] = {6},
[289] = {6},
[290] = {6},
[291] = {6},
[292] = {6},
[293] = {6},
[294] = {6},
[295] = {6},
[296] = {6},
[297] = {6},
[298] = {6},
[299] = {6},
[300] = {6},
[301] = {6},
[302] = {6},
[303] = {6},
[304] = {6},
[305] = {6},
[306] = {6},
[307] = {6},
[308] = {6},
[309] = {6},
[310] = {6},
[311] = {6},
[312] = {6},
[313] = {6},
[314] = {6},
[315] = {6},
[316] = {6},
[317] = {6},
[318] = {6},
[319] = {6},
[320] = {6},
[321] = {6},
[322] = {6},
[323] = {6},
[324] = {6},
[325] = {6},
[326] = {6},
[327] = {6},
[328] = {6},
[329] = {6},
[330] = {6},
[331] = {6},
[332] = {6},
[333] = {6},
[334] = {6},
[335] = {6},
[336] = {6},
[337] = {6},
[338] = {6},
[339] = {6},
[340] = {6},
[341] = {6},
[342] = {6},
[343] = {6},
[344] = {6},
[345] = {6},
[346] = {6},
[347] = {6},
[348] = {6},
[349] = {6},
[350] = {6},
[351] = {6},
[352] = {6},
[353] = {6},
[354] = {6},
[355] = {6},
[356] = {6},
[357] = {6},
[358] = {6},
[359] = {6},
[360] = {6},
[361] = {6},
[362] = {6},
[363] = {6},
[364] = {6},
[365] = {6},
[366] = {6},
[367] = {6},
[368] = {6},
[369] = {6},
[370] = {6},
[371] = {6},
[372] = {6},
[373] = {6},
[374] = {6},
[375] = {6},
[376] = {6},
[377] = {6},
[378] = {6},
[379] = {6},
[380] = {6},
[381] = {6},
[382] = {6},
[383] = {6},
[384] = {6},
[385] = {6},
[386] = {6},
[387] = {6},
[388] = {6},
[389] = {6},
[390] = {6},
[391] = {6},
[392] = {6},
[393] = {6},
[394] = {6},
[395] = {6},
[396] = {6},
[397] = {6},
[398] = {6},
[399] = {6},
[400] = {6},
[401] = {6},
[402] = {6},
[403] = {6},
[404] = {6},
[405] = {6},
[406] = {6},
[407] = {6},
[408] = {6},
[409] = {6},
[410] = {6},
[411] = {6},
[412] = {6},
[413] = {6},
[414] = {6},
[415] = {6},
[416] = {6},
[417] = {6},
[418] = {6},
[419] = {6},
[420] = {6},
[421] = {6},
[422] = {6},
[423] = {6},
[424] = {6},
[425] = {6},
[426] = {6},
[427] = {6},
[428] = {6},
[429] = {6},
[430] = {6},
[431] = {6},
[432] = {6},
[433] = {6},
[434] = {6},
[435] = {6},
[436] = {6},
[437] = {6},
[438] = {6},
[439] = {6},
[440] = {6},
[441] = {6},
[442] = {6},
[443] = {6},
[444] = {6},
[445] = {6},
[446] = {6},
[447] = {6},
[448] = {6},
[449] = {6},
[450] = {6},
[451] = {6},
[452] = {6},
[453] = {6},
[454] = {6},
[455] = {6},
[456] = {6},
[457] = {6},
[458] = {6},
[459] = {6},
[460] = {6},
[461] = {6},
[462] = {6},
[463] = {6},
[464] = {6},
[465] = {6},
[466] = {6},
[467] = {6},
[468] = {6},
[469] = {6},
[470] = {6},
[471] = {6},
[472] = {6},
[473] = {6},
[474] = {6},
[475] = {6},
[476] = {6},
[477] = {6},
[478] = {6},
[479] = {6},
[480] = {6},
[481] = {6},
[482] = {6},
[483] = {6},
[484] = {6},
[485] = {6},
[486] = {6},
[487] = {6},
[488] = {6},
[489] = {6},
[490] = {6},
[491] = {6},
[492] = {6},
[493] = {6},
[494] = {6},
[495] = {6},
[496] = {6},
[497] = {6},
[498] = {6},
[499] = {6},
[500] = {6},
[501] = {6},
[502] = {6},
[503] = {6},
[504] = {6},
[505] = {6},
[506] = {6},
[507] = {6},
[508] = {6},
[509] = {6},
[510] = {6},
[511] = {6},
[512] = {6},
[513] = {6},
[514] = {6},
[515] = {6},
[516] = {6},
[517] = {6},
[518] = {6},
[519] = {6},
[520] = {6},
[521] = {6},
[522] = {6},
[523] = {6},
[524] = {6},
[525] = {6},
[526] = {6},
[527] = {6},
[528] = {6},
[529] = {6},
[530] = {6},
[531] = {6},
[532] = {6},
[533] = {6},
[534] = {6},
[535] = {6},
[536] = {6},
[537] = {6},
[538] = {6},
[539] = {6},
[540] = {6},
[541] = {6},
[542] = {6},
[543] = {6},
[544] = {6},
[545] = {6},
[546] = {6},
[547] = {6},
[548] = {6},
[549] = {6},
[550] = {6},
[551] = {6},
[552] = {6},
[553] = {6},
[554] = {6},
[555] = {6},
[556] = {6},
[557] = {6},
[558] = {6},
[559] = {6},
[560] = {6},
[561] = {6},
[562] = {6},
[563] = {6},
[564] = {6},
[565] = {6},
[566] = {6},
[567] = {6},
[568] = {6},
[569] = {6},
[570] = {6},
[571] = {6},
[572] = {6},
[573] = {6},
[574] = {6},
[575] = {6},
[576] = {6},
[577] = {6},
[578] = {6},
[579] = {6},
[580] = {6},
[581] = {6},
[582] = {6},
[583] = {6},
[584] = {6},
[585] = {6},
[586] = {6},
[587] = {6},
[588] = {6},
[589] = {6},
[590] = {6},
[591] = {6},
[592] = {6},
[593] = {6},
[594] = {6},
[595] = {6},
[596] = {6},
[597] = {6},
[598] = {6},
[599] = {6},
[600] = {6},
[601] = {6},
[602] = {6},
[603] = {6},
[604] = {6},
[605] = {6},
[606] = {6},
[607] = {6},
[608] = {6},
[609] = {6},
[610] = {6},
[611] = {6},
[612] = {6},
[613] = {6},
[614] = {6},
[615] = {6},
[616] = {6},
[617] = {6},
[618] = {6},
[619] = {6},
[620] = {6},
[621] = {6},
[622] = {6},
[623] = {6},
[624] = {6},
[625] = {6},
[626] = {6},
[627] = {6},
[628] = {6},
[629] = {6},
[630] = {6},
[631] = {6},
[632] = {6},
[633] = {6},
[634] = {6},
[635] = {6},
[636] = {6},
[637] = {6},
[638] = {6},
[639] = {6},
[640] = {6},
[641] = {6},
[642] = {6},
[643] = {6},
[644] = {6},
[645] = {6},
[646] = {6},
[647] = {6},
[648] = {6},
[649] = {6},
[650] = {6},
[651] = {6},
[652] = {6},
[653] = {6},
[654] = {6},
[655] = {6},
[656] = {6},
[657] = {6},
[658] = {6},
[659] = {6},
[660] = {6},
[661] = {6},
[662] = {6},
[663] = {6},
[664] = {6},
[665] = {6},
[666] = {6},
[667] = {6},
[668] = {6},
[669] = {6},
[670] = {6},
[671] = {6},
[672] = {6},
[673] = {6},
[674] = {6},
[675] = {6},
[676] = {6},
[677] = {6},
[678] = {6},
[679] = {6},
[680] = {6},
[681] = {6},
[682] = {6},
[683] = {6},
[684] = {6},
[685] = {6},
[686] = {6},
[687] = {6},
[688] = {6},
[689] = {6},
[690] = {6},
[691] = {6},
[692] = {6},
[693] = {6},
[694] = {6},
[695] = {6},
[696] = {6},
[697] = {6},
[698] = {6},
[699] = {6},
[700] = {6},
[701] = {6},
[702] = {6},
[703] = {6},
[704] = {6},
[705] = {6},
[706] = {6},
[707] = {6},
[708] = {6},
[709] = {6},
[710] = {6},
[711] = {6},
[712] = {6},
[713] = {6},
[714] = {6},
[715] = {6},
[716] = {6},
[717] = {6},
[718] = {6},
[719] = {6},
[720] = {6},
[721] = {6},
[722] = {6},
[723] = {6},
[724] = {6},
[725] = {6},
[726] = {6},
[727] = {6},
[728] = {6},
[729] = {6},
[730] = {6},
[731] = {6},
[732] = {6},
[733] = {6},
[734] = {6},
[735] = {6},
[736] = {6},
[737] = {6},
[738] = {6},
[739] = {6},
[740] = {6},
[741] = {6},
[742] = {6},
[743] = {6},
[744] = {6},
[745] = {6},
[746] = {6},
[747] = {6},
[748] = {6},
[749] = {6},
[750] = {6},
[751] = {6},
[752] = {6},
[753] = {6},
[754] = {6},
[755] = {6},
[756] = {6},
[757] = {6},
[758] = {6},
[759] = {6},
[760] = {6},
[761] = {6},
[762] = {6},
[763] = {6},
[764] = {6},
[765] = {6},
[766] = {6},
[767] = {6},
[768] = {6},
[769] = {6},
[770] = {6},
[771] = {6},
[772] = {6},
[773] = {6},
[774] = {6},
[775] = {6},
[776] = {6},
[777] = {6},
[778] = {6},
[779] = {6},
[780] = {6},
[781] = {6},
[782] = {6},
[783] = {6},
[784] = {6},
[785] = {6},
[786] = {6},
[787] = {6},
[788] = {6},
[789] = {6},
[790] = {6},
[791] = {6},
[792] = {6},
[793] = {6},
[794] = {6},
[795] = {6},
[796] = {6},
[797] = {6},
[798] = {6},
[799] = {6},
[800] = {6},
[801] = {6},
[802] = {6},
[803] = {6},
[804] = {6},
[805] = {6},
[806] = {6},
[807] = {6},
[808] = {6},
[809] = {6},
[810] = {6},
[811] = {6},
[812] = {6},
[813] = {6},
[814] = {6},
[815] = {6},
[816] = {6},
[817] = {6},
[818] = {6},
[819] = {6},
[820] = {6},
[821] = {6},
[822] = {6},
[823] = {6},
[824] = {6},
[825] = {6},
[826] = {6},
[827] = {6},
[828] = {6},
[829] = {6},
[830] = {6},
[831] = {6},
[832] = {6},
[833] = {6},
[834] = {6},
[835] = {6},
[836] = {6},
[837] = {6},
[838] = {6},
[839] = {6},
[840] = {6},
[841] = {6},
[842] = {6},
[843] = {6},
[844] = {6},
[845] = {6},
[846] = {6},
[847] = {6},
[848] = {6},
[849] = {6},
[850] = {6},
[851] = {6},
[852] = {6},
[853] = {6},
[854] = {6},
[855] = {6},
[856] = {6},
[857] = {6},
[858] = {6},
[859] = {6},
[860] = {6}
}
local minSkill = 10 -- Substitua 10 pelo valor mínimo da habilidade para começar a treinar
local gainChance = 50 -- Chance de ganhar skill, em porcentagem
local requiredItemID = 13865 -- Substitua 1234 pelo ID do item necessário para treinar aqui
if not skillsToTrain[vocation] then
return false
end
for _, skillToTrain in ipairs(skillsToTrain[vocation]) do
local skillLevel = getPlayerSkillLevel(cid, skillToTrain)
if skillLevel < minSkill then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você não tem a habilidade necessária para treinar aqui.")
return true
end
-- Verifica se o jogador está equipado com o item necessário
local rightSlotItem = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
if not rightSlotItem or rightSlotItem.itemid ~= requiredItemID then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você precisa estar equipado com o item necessário para treinar aqui.")
return true
end
-- Verifica se o jogador está na posição correta
if not isInRange(playerPosition, position, 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você não está na posição correta para treinar.")
return true
end
-- Adiciona um evento para ganhar skill a cada 3 segundos
local event = addEvent(function()
-- Verifica se o jogador ainda está na posição correta
local currentPlayerPosition = getCreaturePosition(cid)
if not isInRange(currentPlayerPosition, position, 1) then
-- Se o jogador não estiver mais na posição, cancela o evento e remove da tabela de eventos
if skillEvents[cid] then
stopEvent(skillEvents[cid])
skillEvents[cid] = nil
end
return
end
-- Verifica se o jogador ganha skill
if math.random(100) <= gainChance then
doPlayerAddSkillTry(cid, skillToTrain)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você ganhou experiência em " .. getSkillName(skillToTrain) .. ".")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Você não ganhou experiência em " .. getSkillName(skillToTrain) .. ".")
end
end, 3000) -- 3000 milissegundos = 3 segundos
-- Armazena o evento na tabela de eventos, associando ao jogador
skillEvents[cid] = event
end
return true
end
function onLogout(cid)
-- Verifica se o jogador está na tabela de eventos
if skillEvents[cid] then
-- Cancela o evento temporizado e remove da tabela de eventos
stopEvent(skillEvents[cid])
skillEvents[cid] = nil
end
return true
end
this is the erro