Jump to content

Tahseen

Members
  • Posts

    11
  • Joined

  • Last visited

Details

  • Gang
    Infected Zombies

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Tahseen's Achievements

Square

Square (6/54)

0

Reputation

  1. Tahseen

    MYBB webiste

    Hello Im Looking For MYBB Scripter To make our website please apply soon i need ur help !
  2. Tahseen

    Tables Issue

    Thank you very much! It's now working perfectly! I really appreciate your support to me!
  3. Tahseen

    Tables Issue

    And when i want to catch the table in element data what shall i use? local index = getElementData(player,"VS.Count") local theTable = getElementData(player,"VS.Vehicles") for ind,ent in ipairs(theTable) do createVehicle(ent[index].1,1,1,1) end Will this work as an example in client side?
  4. Tahseen

    Tables Issue

    Thank you so much! I will try it now.
  5. Tahseen

    Tables Issue

    But how can i catch the values in the table? Because they aren't responding.
  6. Tahseen

    Tables Issue

    Already doing it,thanks for support!
  7. Tahseen

    Tables Issue

    setElementData(player,"VS.Vehicles",toJSON(theTable)) I used this to save the table and to get the table by this: local theTable = {fromJSON(getElementData(player,"VS.Vehicles"))} Btw they are already in the code above.
  8. Tahseen

    Tables Issue

    Hello guys,i need you to help me in my script which doesn't work and if it is working it usually saves 1 vehicle only and i don't want it to work like that so if you have knowledge of fixing it then please help me. Here is the code: createdVehicle = {} function buyVehicle(player,id,price) local money = getPlayerMoney(player) if ( money >= price ) and ( not ( isGuestAccount(getPlayerAccount(player)) ) ) and ( not ( getElementData(player,"VS.Count") == 5 ) ) then local x, y, z = getElementPosition(player) if ( isElement(createdVehicle[player]) ) then destroyElement(createdVehicle[player]) end createdVehicle[player] = createVehicle(id,x,y-3,z) if ( createdVehicle[player] ) then if ( getElementData(player,"VS.Vehicles") == false ) then local aTable = {} local jsone = toJSON(aTable) setElementData(player,"VS.Vehicles",jsone) local i = getElementData(player,"VS.Count") if ( i == false ) then setElementData(player,"VS.Count",0) else setElementData(player,"VS.Count",tonumber(i)+1) end end local theTable = {fromJSON(getElementData(player,"VS.Vehicles"))} if ( type(theTable) == "table" ) and ( not ( theTable == false ) ) or ( not ( theTable == nil ) ) then for ind,ent in ipairs(theTable) do local i = getElementData(player,"VS.Count")+1 theTable[i][1] = id --[[ HERE is the problem ]]-- theTable[i][2] = 1000 --[[ and here ]]-- theTable[i][3] = price/2 --[[ and here ]]-- setElementData(player,"VS.Vehicles",toJSON(theTable)) setElementData(player,"VS.Count",i) setElementData(createdVehicle[player],"Owner",player) setElementData(createdVehicle[player],"VS.Count",i) takePlayerMoney(player,price) outputChatBox("[Vehicle System] You have bought ".. getVehicleNameFromModel(id) .." for ".. price .."$ !",player,0,255,0) end else outputChatBox("[Vehicle System] Error purchasing a car!",player,255,0,0) end end elseif ( isGuestAccount(getPlayerAccount(player)) ) then outputChatBox("[Vehicle System] Please login in order to buy a vehicle!",player,255,0,0) elseif ( money < price ) then outputChatBox("[Vehicle System] You don't have enough money to buy this car!",player,255,0,0) elseif ( getElementData(player,"VS.Count") == 5 ) then outputChatBox("[Vehicle System] You have reached the maximum amount of vehicles to purchase!",255,0,0) end end Thanks in advance.
  9. Tahseen

    Sql error

    Try this one: function onStart() dbExec(handler, "CREATE TABLE IF NOT EXISTS vehicles (id int(11), model int(3), x decimal(10,6), y decimal(10.6), z decimal(10.6), rotx decimal(10.6), roty decimal(10,6), rotz decimal(10.6), engine int(1), locked int(1), lights int(1), hp float, color1 varchar(50), color2 varchar(50), plate text, owner text, interior int(5), dimension int(5), upgrades varchat(150), headLights varchar(30), variant1 int(3), variant2 int(3))"); dbExec(handler, "INSERT INTO vehicles (model,x,y,z,rotx,roty,rotz,engine,locked,lights,hp,color1,color2,interior,dimension,upgrades,headLights,variant1,variant2) VALUES (0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,100,0,0,0,0,'[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ]',' [ [ 255, 255, 255 ] ]','NULL','NULL')"); end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart)
×
×
  • Create New...