This should work (tested)
function skillButtonFunc (Levelids, Levelnames,Levelmoneys,LevelLevels ,LevelStatus)
outputChatBox("skill buy")
if (Levelids == "0" or Levelids == 0) then
outputChatBox("0")
getThisElementData(4,source)
takeMoneyFunc(3250,4,source)
setPedStat(source, 71, 99)
elseif (Levelids == "1" or Levelids == 1) then
getThisElementData(1,source)
takeMoneyFunc(5500,1,source)
setPedStat(source, 71, 299)
end
end
addEvent ("PlayerSkillBuy", true)
addEventHandler ("PlayerSkillBuy", getRootElement(),skillButtonFunc)
function takeMoneyFunc(cashs,level,player)
if (getPlayerMoney (player) >= tonumber(cashs)) then
if getElementData(player,"Level") == tonumber(level) then
outputChatBox("skill buying")
takePlayerMoney (player,cashs)
else
end
else
outputChatBox("you not have money ")
end
end
function getThisElementData(data,player)
if (getElementData (player,"Level") == tonumber(data)) then
outputChatBox("level suitable")
return true
else
outputChatBox("Level insufficient ")
return false
end
end