Jump to content

Mann56

Members
  • Posts

    306
  • Joined

  • Last visited

Everything posted by Mann56

  1. Yup the function is working correctly. Client window = {} label = {} function showVapidCount(Vapid) outputDebugString ( tostring ( Vapid ) ) if Vapid then if Vapid == nil then VapidCount = 1 else VapidCount = Vapid end else VapidCount = 0 end end addEvent("VapidStock",true) addEventHandler("VapidStock",root,showVapidCount) function createGUI() window.stock = guiCreateWindow(533, 136, 378, 496, "My Window", false) guiWindowSetSizable(window.stock, false) label.lol = guiCreateLabel(8, 28, 360, 37, "Vapid Stock : "..tostring(VapidCount).."", false, window.stock) guiSetVisible(window.stock,false) end addEventHandler("onClientResourceStart", resourceRoot, createGUI) local state = false bindKey ( "f5", "down", function () if state == false then guiSetVisible(window.stock,true) showCursor(true) state = true else guiSetVisible(window.stock,false) showCursor(false) state = false end end ) EDIT : The script is working now, i did : window = {} label = {} function showVapidCount(Vapid) outputDebugString ( tostring ( Vapid ) ) if Vapid then if Vapid == nil then VapidCount = 1 else VapidCount = Vapid end else VapidCount = 0 end end addEvent("VapidStock",true) addEventHandler("VapidStock",root,showVapidCount) function createGUI() window.stock = guiCreateWindow(533, 136, 378, 496, "My Window", false) guiWindowSetSizable(window.stock, false) label.lol = guiCreateLabel(8, 28, 360, 37, "Vapid Stock : "..tostring(VapidCount).."", false, window.stock) guiSetVisible(window.stock,true) end local state = false bindKey ( "f5", "down", function () if state == false then createGUI() showCursor(true) state = true else guiSetVisible(window.stock,false) showCursor(false) state = false end end )
  2. I already tried it but then the gui shows 0 only...
  3. Hey Guys, I was making a resource where i encountered a problem. The problem is whenever i open the gui i made, the label which shows variable VapidCount always shows nil... This is because the gui is triggered before the functioning defining VapidCount, how can i prevent this... as the bindKey wants the gui function executed before itself but i need to make the gui after the showVapidCount function. window = {} label = {} function showVapidCount(Vapid) if Vapid then if Vapid == nil then VapidCount = 1 else VapidCount = Vapid end else VapidCount = 0 end end addEvent("VapidStock",true) addEventHandler("VapidStock",root,showVapidCount) function createGUI() window.stock = guiCreateWindow(533, 136, 378, 496, "My Window", false) guiWindowSetSizable(window.stock, false) label.lol = guiCreateLabel(8, 28, 360, 37, "Vapid Stock : "..tostring(VapidCount).."", false, window.stock) guiSetVisible(window.stock,false) end addEventHandler("onClientResourceStart", resourceRoot, createGUI) local state = false bindKey ( "f5", "down", function () if state == false then guiSetVisible(window.stock,true) showCursor(true) state = true else guiSetVisible(window.stock,false) showCursor(false) state = false end end ) Some help/advice would be appreciated. Regards, Mann
  4. Creating a database is rather simple all you have to use is dbConnect other SQL functions are dbConnect dbExec dbQuery dbPoll dbFree Be sure to look at them before using SQL, here's a tutorial by JR10 about SQLite - > Click Here In your case, you want to make a database, all you need to do is connection = dbConnect("sqlite","mydb.db") -- Here we have initialized a variable connection which stores our connection with mydb, the database will be created automatically. You can also work with MySQl but you will need to set up a server for it. I recommend you SQLite. For checking the database you can use SQlite Browser
  5. Username (In control panel): Mann First Name: Mann Last Name: Bilimoria Birthday: 06/10/1999 Skype: mann.mta Email: [email protected] Choose a server (Alpha,Charlie,Bravo): Alpha Server Slot: 50 Server Name: Mann's Minion Reason that you want a free MTASA Server: I am a scripter and i want a place to experiment my scripts and am making roleplay scripts, sometimes can expect some friends on the server...
  6. Wrong section. This is the correct section
  7. Corrected it! Made whole server side.
  8. Server side function fly(cmd,targetPlayer) local name = getPlayerFromName(targetPlayer) local vehicle = getPedOccupiedVehicle(name) if (isVehicleOnGround( vehicle ) == true) then local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx+0.5, sy, sz+0.6 ) end end addCommandHandler("flyman",fly)
  9. local player was used in your script so i thought it was for the player itself... I suggest you to make it server sided... like this -> function fly(cmd,targetPlayer) local vehicle = getPedOccupiedVehicle(targetPlayer) if (isVehicleOnGround( vehicle ) == true) then local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.3 ) end end addCommandHandler("flyman",fly) But beware, the player must be in a car to execute this!
  10. Thanks Karim, it worked!! So you got the first index under column Id... Thanks i'll keep this method in mind.
  11. Well i did : function(thePlayer) local owner = getAccountName(getPlayerAccount(thePlayer)) local check = dbPoll(dbQuery(connection,"SELECT Id FROM purchasedCars WHERE Owner = ? AND Slot = ?",owner,1),-1) if #check == 1 then local id = table.concat(check) outputChatBox(id) local x,y,z = getElementPosition(thePlayer) createVehicle(id,x+5,y+5,z) end end it Said: Invalid value (table) at index 1 in table for 'concat'
  12. function fly(thePlayer) local vehicle = getPedOccupiedVehicle(localPlayer) if (isVehicleOnGround( vehicle ) == true) then local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.3 ) end end addCommandHandler("flyman",fly)
  13. Hey guys, I've been working on a vehicle-system and i want to retrieve an item from a table, which i don't know how to do... function(thePlayer) local owner = getAccountName(getPlayerAccount(thePlayer)) local check = dbPoll(dbQuery(connection,"SELECT Id FROM purchasedCars WHERE Owner = ? AND Slot = ?",owner,1),-1) if #check == 1 then -- I want to get the model id present inside table in a variable 'id' here local x,y,z = getElementPosition(thePlayer) createVehicle(id,x+5,y+5,z) end end Some help would be appreciated. I just want the model id from the table 'check' , table.concat didn't work...
  14. Mann56

    Question

    no no u didn't understand me example : it's gui when player Kill some in LS they gui showed to the killed player the he chose Jail Him or Forgive him i hope u understand me now Use the event when the player is killed : onPlayerWasted Get the killer and then if you want a gui to pop up, then use triggerClientEvent and make a gui.
  15. That's real hard work! Never mind, you take your time ,quality first!!!
  16. Really great work dude!! The physics is amazing!! Rode the ZR-350,amazing! Keep up the good work. It's really hard to make what you did.. Waiting for new cars
  17. Mann56

    DUP Output

    It's repeated/duplicated output afaik. In my resources , often it happens that when you trigger a function which is supposed to show on debugscript again before getting the previous result, it might give DUP. For ex. in my vehicle system, i had a debug string output "Bought" when someone buys a vehicle.Whenever i made 3 to 4 purchases fast it gave me DUP x 4. So it's repetition of same message.
  18. We don't loop data from a table by using dbExec, Use dbQuery instead. I'll keep that in mind, thanks Karim!
  19. At the line of error change ttcounter to tonumber(ttcounter)
  20. Yes: local sizeX = self.size.x local sizeY = 15 + 46 + 20 * ttcounter guiSetSize( self.gui['windowbg'], sizeX, sizeY, false ) -- Make listTimes contains the correct number of labels self:updateLabelCount(numLines) local sizeX = self.size.x local sizeY = 15 + 46 + 20 * ttcounter if (tonumber(numLines) <= 11) then if oldTT == 0 then local oldTT = 1 end for i=1,11 do if Pos[i] then for k=1,#WszystkieToptimy[i] do if(WszystkieToptimy)and(WszystkieToptimy[i])and(isElement(WszystkieToptimy[i][k]))then destroyElement(WszystkieToptimy[i][k]) end end end if playerName[i] then for j=1,#FunKy[i] do if(FunKy)and(FunKy[i])and(isElement(FunKy[i][j]))then destroyElement(FunKy[i][j]) end end end if timeT[i] then for f=1,#FunKyTTS[i] do if(FunKyTTS)and(FunKyTTS[i])and(isElement(FunKyTTS[i][f]))then destroyElement(FunKyTTS[i][f]) end end end if dateT[i] then for e=1,#FunKyTopTimes[i] do if(FunKyTopTimes)and(FunKyTopTimes[i])and(isElement(FunKyTopTimes[i][e]))then destroyElement(FunKyTopTimes[i][e]) end end end end -- if ownoldtt == true then -- destroyElement(WszystkieToptimy[11][k]) -- destroyElement(FunKy[11][j]) -- destroyElement(FunKyTTS[11][f]) -- destroyElement(FunKyTopTimes[11][e]) -- ownoldtt = false -- end end local oldTT = 0 localTT = false if (tonumber(ttcounter) < 1) then for i=1,1 do Pos[i] = 1 playerName[i] = 1 timeT[i] = 1 dateT[i] = 1 WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.05+(0.055*6)), self.size.x*0.84, self.size.y*0.1, "", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.40, self.size.y*(0.05+(0.055*6)), self.size.x*0.84, self.size.y*0.1, getPlayerName(getLocalPlayer())..",", false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabel(self.size.x*0.15, self.size.y*(0.20+(0.055*6)), self.size.x*0.84, self.size.y*0.1, "There was no pro to finish this map.", false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabel(self.size.x*0.20, self.size.y*(0.30+(0.055*6)), self.size.x*0.84, self.size.y*0.1, "Show them who's the boss!", false, self.gui['paneTimes'] ) oldTT = 1 local sizeY = 15 + 46 + 20 * 5 guiSetSize( self.gui['windowbg'], sizeX, sizeY, false ) end else --Update the list items for i=1,numLines do local y = 10 local ttline = 0.065 * i local x = 0 -- local timeText = data[i].timeText -- if timeText:sub(112) == '0' then -- timeText = ' ' .. timeText:sub(2) -- end Pos[i] = 1 playerName[i] = 1 timeT[i] = 1 dateT[i] = 1 oldTT = tonumber(numLines) if i == 1 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.255+ttline), self.size.x*0.84, self.size.y*0.1, "#00FF001", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.24+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.255+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.255+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 2 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.30+ttline), self.size.x*0.84, self.size.y*0.1, "#33FF002", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.29+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.305+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.305+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 3 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.35+ttline), self.size.x*0.84, self.size.y*0.1, "#66FF003", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.34+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.355+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.355+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 4 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.40+ttline), self.size.x*0.84, self.size.y*0.1, "#99FF004", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.39+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.405+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.405+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 5 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.45+ttline), self.size.x*0.84, self.size.y*0.1, "#AAFF005" , false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.44+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.455+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.455+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 6 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.50+ttline), self.size.x*0.84, self.size.y*0.1, "#FFFF006", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.49+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.505+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.505+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 7 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.55+ttline), self.size.x*0.84, self.size.y*0.1, "#FFBB007", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.54+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.555+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.555+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 8 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.60+ttline), self.size.x*0.84, self.size.y*0.1, "#FF99008", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.59+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.605+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.605+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 9 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.65+ttline), self.size.x*0.84, self.size.y*0.1, "#FF66009", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.64+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.655+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.655+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 10 then WszystkieToptimy[i] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.70+ttline), self.size.x*0.84, self.size.y*0.1, "#FF330010", false, self.gui['paneTimes'] ) FunKy[i] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.69+ttline), self.size.x*0.84, self.size.y*0.1, data[i].playerName, false, self.gui['paneTimes'] ) FunKyTTS[i] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.705+ttline), self.size.x*0.84, self.size.y*0.1, data[i].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[i] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.705+ttline), self.size.x*0.84, self.size.y*0.1, data[i].dateRecorded, false, self.gui['paneTimes'] ) end if i == 11 then if playerPosition then if tonumber(playerPosition) >= 11 then WszystkieToptimy[11] = guiCreateColoredLabelFont2(self.size.x*0.05, self.size.y*(0.75+0.065 * 11), self.size.x*0.84, self.size.y*0.1, "#0090FF"..playerPosition, false, self.gui['paneTimes'] ) FunKy[11] = guiCreateColoredLabel(self.size.x*0.12, self.size.y*(0.74+0.065 * 11), self.size.x*0.84, self.size.y*0.1, ownTT[playerPosition].playerName, false, self.gui['paneTimes'] ) FunKyTTS[11] = guiCreateColoredLabelFont(self.size.x*0.55, self.size.y*(0.755+0.065 * 11), self.size.x*0.84, self.size.y*0.1, ownTT[playerPosition].timeText, false, self.gui['paneTimes'] ) FunKyTopTimes[11] = guiCreateColoredLabelFont(self.size.x*0.795, self.size.y*(0.755+0.065 * 11), self.size.x*0.84, self.size.y*0.1, ownTT[playerPosition].dateRecorded, false, self.gui['paneTimes'] ) end end end end end Well wherever you have this line : local sizeY = 15 + 46 + 20 * ttcounter use local sizeY = 15 + 46 + 20 * tonumber(ttcounter) So wherever you performed any arithmetic operation on ttcounter use tonumber()
  21. Thanks tosfera! The script i made is working fine but it blows up vehicles when i try to get rid of em. blowVehicle doesn't allow silent blowing up and explodes... Is there any other way to prevent explosion? My code function click() local getName = guiGridListGetItemText ( grid.car, guiGridListGetSelectedItem ( grid.car ), 3 ) if not vehView then vehView = createVehicle(getName,-1952.0537109375,263.626953125,41.047080993652) else local modelType = getElementModel(vehView) if getName == modelType then return else local blow = blowVehicle(vehView) vehView = createVehicle(getName,-1952.0537109375,263.626953125,41.047080993652) end end setCameraMatrix(-1956.177734375,263.4619140625,41.047080993652,-1952.0537109375,263.626953125,41.047080993652) end EDIT : Solved , used destroyElement instead of blowVehicle. Silly me, i forgot destroyElement... Anyway thanks tosfera for the wonderful idea!
  22. In the error, there is a mention of line 530. The problem is there... can i see it?
×
×
  • Create New...