Jump to content

Antonio

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Antonio

  1. Antonio

    House system

    Nobody will help me?
  2. Antonio

    House system

    I have problem with JasperNL and TurboCow house system,when i buy 2 house, then sell them then I want to buy new one then i got in chatbox "You cant have more than 2 house!".I think the problem is here: addEventHandler ("HouseSystemSellHouse", getRootElement(), function(housenumber) if ( housesCanBuy == 1 ) then root = xmlLoadFile ("homes.xml") local houseHeadRootNode = xmlFindChild (root,"houses",0) local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber)) local price = xmlNodeGetAttribute (houseRootNode,"sellprice") local owner = xmlNodeGetAttribute (houseRootNode,"owner") if not (isGuestAccount (getPlayerAccount(source))) then if (owner == getAccountName(getPlayerAccount(source))) then local playeraccount = getPlayerAccount ( source ) setAccountData ( playeraccount, "house", "no" ) setAccountData ( playeraccount, "price", "---" ) setAccountData ( playeraccount, "number", "---" ) setAccountData ( playeraccount, "sell", "---" ) setAccountData ( playeraccount, "street", "---" ) setAccountData ( playeraccount, "housex", "---" ) setAccountData ( playeraccount, "housey", "---" ) setAccountData ( playeraccount, "housez", "---" ) givePlayerMoney (source,tonumber(price)) xmlNodeSetAttribute (houseRootNode,"owner","") xmlNodeSetAttribute (houseRootNode,"lockStatus","unlock") outputChatBox ("You sold your house!",source,255,200,0,false) xmlSaveFile (root) for i,v in ipairs ( getElementsByType("pickup")) do local number = getElementData ( v, "housenumber" ) if ( number == housenumber ) then setPickupType ( v, 3, 1273 ) end end elseif not (owner == getAccountName(getPlayerAccount(source))) then outputChatBox ("This is not your house!",source,255,200,0,false) end else outputChatBox ("Please log in!",source,255,200,0,false) end xmlSaveFile(root) elseif ( housesCanBuy == 2 ) then local root = xmlLoadFile ("homes.xml") local houseHeadRootNode = xmlFindChild (root,"houses",0) local houseRootNode = xmlFindChild (houseHeadRootNode,"house",tonumber(housenumber)) local price = xmlNodeGetAttribute (houseRootNode,"sellprice") local owner = xmlNodeGetAttribute (houseRootNode,"owner") if not (isGuestAccount (getPlayerAccount(source))) then if (owner == getAccountName(getPlayerAccount(source))) then local playeraccount = getPlayerAccount ( source ) local house1 = getAccountData ( playeraccount, "house" ) if ( house1 ) then local number = getAccountData ( playeraccount, "number") if ( number == housenumber ) then setAccountData ( playeraccount, "house", "no" ) setAccountData ( playeraccount, "price", "---" ) setAccountData ( playeraccount, "number", "---" ) setAccountData ( playeraccount, "sell", "---" ) setAccountData ( playeraccount, "street", "---" ) setAccountData ( playeraccount, "housex", "---" ) setAccountData ( playeraccount, "housey", "---" ) setAccountData ( playeraccount, "housez", "---" ) givePlayerMoney (source,tonumber(price)) xmlNodeSetAttribute (houseRootNode,"owner","") xmlNodeSetAttribute (houseRootNode,"lockStatus","unlock") outputChatBox ("You sold your house!",source,255,200,0,false) xmlSaveFile (root) for i,v in ipairs ( getElementsByType("pickup")) do local number = getElementData ( v, "housenumber" ) if ( number == housenumber ) then setPickupType ( v, 3, 1273 ) end end else local house2 = getAccountData ( playeraccount, "house2" ) if ( house2 ) then local number2 = getAccountData ( playeraccount, "number2") if ( number2 == housenumber ) then setAccountData ( playeraccount, "house2", "no" ) setAccountData ( playeraccount, "price2", "---" ) setAccountData ( playeraccount, "number2", "---" ) setAccountData ( playeraccount, "sell2", "---" ) setAccountData ( playeraccount, "street2", "---" ) setAccountData ( playeraccount, "housex2", "---" ) setAccountData ( playeraccount, "housey2", "---" ) setAccountData ( playeraccount, "housez2", "---" ) givePlayerMoney (source,tonumber(price)) xmlNodeSetAttribute (houseRootNode,"owner","") xmlNodeSetAttribute (houseRootNode,"lockStatus","unlock") outputChatBox ("You sold your house!",source,255,200,0,false) xmlSaveFile (root) for i,v in ipairs ( getElementsByType("pickup")) do local number = getElementData ( v, "housenumber" ) if ( number == housenumber ) then setPickupType ( v, 3, 1273 ) end end end end end end elseif not (owner == getAccountName(getPlayerAccount(source))) then outputChatBox ("This is not your house!",source,255,200,0,false) end else outputChatBox ("Please log in!",source,255,200,0,false) end end xmlUnloadFile (root) xmlSaveFile (root) end)
  3. I have already problems with rotation: Server: local vehicle = {} function isVehicleSpawned(vehicle) return getElementData(vehicle, "jobvehicle") end function doesPlayerHaveVehicleSpawned(player) if (isElement(vehicle[player])) then return true else return false end end function destroyVehicle(vehicle, player) if (isElement(vehicle[player])) then destroyElement(vehicle[player]) end end function createTheJobVehicles() for index, table in ipairs(vehicles) do marker = createMarker(table.x, table.y, table.z, "cylinder", 2, table.r, table.g, table.b) setElementData(marker, "vehiclemarker-role", table.Roles) setElementData(marker, "vehiclemarker-vehicles", table.vehicles) setElementData(marker, "vehiclemarker-rotation", table.rotation) vehicle[marker] = table.Roles local position = table.x..", "..table.y..", "..table.z..", "..", "..table.rotation local color = table.vehR..", "..table.vehG..", "..table.vehB..", " setElementData(marker, "vehiclemarker-position", position) setElementData(marker, "vehiclemarker-color", color) addEventHandler("onMarkerHit", marker, onPlayerVehicleMarkerHit) end end addEventHandler("onResourceStart", resourceRoot, createTheJobVehicles) function onPlayerVehicleMarkerHit(player) local role = getElementData(source, "vehiclemarker-role") local vehicles = getElementData(source, "vehiclemarker-vehicles") local rotation = getElementData(source, "vehiclemarker-rotation") if (getElementType(player) == "player") then if (getElementData(player, dataToFindPlayersJob) == role or role == "ALL") then if (isPedInVehicle(player)) then return end local position = getElementData(source, "vehiclemarker-position") local color = getElementData(source, "vehiclemarker-color") local posX, posY, posZ, rotation = unpack(split(position, ",")) local r, g, b = unpack(split(color, ",")) triggerClientEvent(player, "jobvehicles.showVehicleGUI", root, vehicles, rotation, posX, posY, posZ, rotation, r, g, b) end end end function onPlayerSpawnVehicle(vid, vx, vy, vz, rotation, r, g, b) if (isElement(vehicle[client])) then destroyElement(vehicle[client]) end vehicle[client] = createVehicle(vid, vx, vy, vz) setElementData(vehicle[client], "jobvehicle", true) warpPedIntoVehicle(client, vehicle[client]) setElementRotation(vehicle[client], 0, 0, rotation) outputDebugString(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid)) outputServerLog(getPlayerName(client).. " has spawned a '"..getVehicleNameFromModel(vid).."'") if (r) then setVehicleColor(vehicle[client], r, g, b) end end addEvent("jobvehicles.onPlayerSpawnVehicle", true) addEventHandler("jobvehicles.onPlayerSpawnVehicle", root, onPlayerSpawnVehicle) function destroyPlayerVehicle() if (isElement(vehicle[source])) then destroyElement(vehicle[source]) end end addEventHandler("onPlayerWasted", root, destroyPlayerVehicle) addEventHandler("onPlayerLogout", root, destroyPlayerVehicle) addEventHandler("onPlayerQuit", root, destroyPlayerVehicle) function destroyMyOwnVehicle(player) if (isElement(vehicle[player])) then outputChatBox("You have succesfully destroyed your "..getVehicleNameFromModel(getElementModel(vehicle[player])).."!", player, 0, 255, 10) destroyElement(vehicle[player]) elseif (not isElement(vehicle[player])) then outputChatBox("You currently do not have a job vehicle spawned to destroy!", player, 250, 0, 0) end end addCommandHandler("destroyv", destroyMyOwnVehicle) function destroyVehicleOnExplode() if (getElementData(source, "jobvehicle")) then destroyElement(source) end end addEventHandler("onVehicleExplode", root, destroyVehicleOnExplode) function onAdminDestroyJobVehicle(admin, cmd, target) local accountname = getAccountName(getPlayerAccount(admin)) if (hasObjectPermissionTo("user."..accountname, "function.kickPlayer") and target) then local player = getPlayerFromName(target) if (isElement(vehicle[player]) and player) then outputChatBox("You have destroyed "..getPlayerName(player).."' s "..getVehicleNameFromModel(getElementModel(vehicle[player])).." (jobvehicle)", admin, 0, 255, 10) outputChatBox(getPlayerName(admin).." has destroyed your "..getVehicleNameFromModel(getElementModel(vehicle[player])).." (jobvehicle)", player, 255, 10, 0) destroyElement(vehicle[player]) elseif (not isElement(vehicle[player]) and player) then outputChatBox(getPlayerName(player).. " does not currently have any job vehicle spawned.", admin, 255, 10, 0) else outputChatBox("The player do not exist!", admin, 250, 0, 0) end end end addCommandHandler("dv", onAdminDestroyJobVehicle) Client: local screenWidth, screenHeight = guiGetScreenSize() local v_table = {} function createVehicleChooserGUI() if (isElement(wndVehicle)) then if (guiGetVisible(wndVehicle)) then return end end wndVehicle = guiCreateWindow(385, 165, 280, 383, "Vehicle spawn",false) vehicleLabel = guiCreateLabel(9,25,262,25,"Select vehicle:",false,wndVehicle) gridVehicle = guiCreateGridList(9,47,260,285,false,wndVehicle) vehicleColumn = guiGridListAddColumn(gridVehicle,"Vehicle",0.-- s8) --> vehicleSpawn = guiCreateButton(151,336,122,38,"Select",false,wndVehicle) vehicleClose = guiCreateButton(9,336,122,38,"Close",false,wndVehicle) addEventHandler("onClientGUIClick", vehicleSpawn, onPlayerSelectVehicle) addEventHandler("onClientGUIClick", vehicleClose, onPlayerExitVehicleGUI) end function showVehicleGUI(vehicles, rotation, posX, posY, posZ, rotation, r, g, b) createVehicleChooserGUI() v_table[1] = posX v_table[2] = posY v_table[3] = posZ v_table[4] = rotation v_table[5] = r v_table[6] = g v_table[7] = b showCursor(true) guiGridListClear(gridVehicle) for index, vehicles in ipairs(vehicles) do vehicleRow = guiGridListAddRow(gridVehicle) guiGridListSetItemText(gridVehicle, vehicleRow, vehicleColumn, getVehicleNameFromModel(vehicles), false, true) end end addEvent("jobvehicles.showVehicleGUI", true) addEventHandler("jobvehicles.showVehicleGUI", root, showVehicleGUI) function onPlayerExitVehicleGUI(button, state) if (button ~= "left" or state ~= "up") then return end guiSetVisible(wndVehicle, false) showCursor(false) end function onPlayerSelectVehicle(button, state) if (button ~= "left" or state ~= "up") then return end if (guiGridListGetSelectedItem(gridVehicle) == -1) then return end local vrow = guiGridListGetSelectedItem(gridVehicle) local vname = guiGridListGetItemText(gridVehicle, vrow, vehicleColumn) local vid = getVehicleModelFromName(vname) guiSetVisible(wndVehicle, false) showCursor(false) triggerServerEvent("jobvehicles.onPlayerSpawnVehicle", root, vid, v_table[1], v_table[2], v_table[3], v_table[4], v_table[5], v_table[6], v_table[7]) end
  4. Antonio

    Group

    Its good for newbie scripters! +1!
  5. Hello,i using JasperNL and TheTurboCow house system and i have problems with this script.I followed all the instructions how to use it,but when i make new house then when i restart script it doesnt make house
×
×
  • Create New...