Jump to content

..:D&G:..

Members
  • Posts

    1,028
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ..:D&G:..

  1. You will only get that error when you are calling a function inside this loop, which is related to the function which contains this loop. This is an example how you get this error: function testFunction () testFunction() end testFunction() But there is no function called inside the loop, there is only the local "amount"
  2. Any ideas why I get "C stack overflow" here? for s, o in pairs(occupants) do
  3. Is there a way to have the tooltips thing on dxDrawImage? tooltips only work on gui elements and not on dx drawn... Maybe there is a way to detect the image by hovering the mouse over it? Thanks.
  4. Well that kinds sucks... Anyway, is there a method to find a free seat in a vehicle?
  5. That worked, thanks.. I have another problem now... Is there a way to find out if there is a free seat in a vehicle and make the ped enter the car as a passenger? This is what I've done and the ped doesn't enter the vehicle even if they are close to it: function makeGirlfriendEnterVehicle(thePlayer, seat, jacked) local vehicle = getPlayerOccupiedVehicle(thePlayer) local occupants = getVehicleOccupants(vehicle) amount = 0 for s, o in pairs(occupants) do local amounta = amount amount = amounta + 1 end local maxPassengers = getVehicleMaxPassengers(vehicle) if not (getElementData(thePlayer, "gfFollow") == nil) then for i, v in ipairs(getElementsByType("ped")) do if (getElementData(v, "name") == getElementData(thePlayer, "hasGirlfriend")) and (getElementData(v, "type") == "girlfriend") then girlFriendPed = v end end if (maxPassengers > amount) then amount = 0 triggerClientEvent ( "girlfriend_EnterCar", girlFriendPed ) end else return end end addEventHandler ( "onVehicleStartEnter", getRootElement(), makeGirlfriendEnterVehicle ) addEvent( "girlfriend_EnterCar", true ) function BEnterCar ( ) if (isElement(source)) then setPedControlState( source, "enter_passenger", true ) end end addEventHandler( "girlfriend_EnterCar", getRootElement(), BEnterCar )
  6. So, I want to get the number of people that are in a vehicle so that I can then compare it to the max passengers the vehicle can hold. I've tried #getVehicleOccupants(vehicle) but it always outputs 0... Any ideas? Thanks.
  7. I restarted the server and it works now, dunno what was wrong with it
  8. We have decided to make a Pre-Alpha server which will be open at all times! Everyone that is interested in joining the Pre-Alpha and Alpha testing can request an Alpha key which can be used to make an account on the server! To join just tell us you are interested and tell us something about your experience with survival servers by replying to this topic! PLEASE NOTE, that there are still A LOT of bugs on the server and that we are still adding and improving the server's features, so for those testers that have a bit of scripting knowledge we have enabled the debugscript console from which you can report to us any error you find! Server IP: PROJECT DEAD Thank You!
  9. Ok so the script worked before, now it says that an element was expected at argument 2, but got string (which is the event name). I know for a fact that at argument 2 I'm supposed to put the event name, I even checked the wiki... triggerClientEvent(thePlayer, "createNotification", thePlayer, id, font, scale, textColor, bgColor, itemName, itemValue, destroyable) Any ideas? Thanks.
  10. Um... I've fixed it long time ago, but ok...
  11. --------------------------- -- Weapon window --------------------------- function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Give weapon', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Weapon', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='add', onclick=addWeapon}, {'btn', id='close', closeswindow=true} } } local dimension = 1 local thePlayer = getLocalPlayer() function giveWeaponCommand(cmd, weapon, amount) if (getElementDimension(thePlayer) == dimension) then weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) else outputChatBox("You cannot take a weapon as you are not in the right dimension!", 255, 0, 0) end end addCommandHandler('give', giveWeaponCommand) addCommandHandler('wp', giveWeaponCommand)
  12. local accID = getAccountID(username) or 0 dbExec(connection, "INSERT INTO `userdata` SET `userid`='" .. accID .. "', `online`='0', `username`='" .. username .. "', `usergroupid`='0', `registered`='1', `admin`='0', `joined`='" .. getTheTime() .. "', `team`='nil', `serial`='"..getPlayerSerial(player).."', `ip`='"..getPlayerIP(player)"', `lastvisit`='"..getTheTime().."', `cc`='EN', `playtime`='0', `settings`='0', `stunts`='0', `tuning`='0', `shooterlevel`='0', `clan`='0', `arena`='0', `language`='Enlgish', `autosave`='1', `special`='0', `nickname`='"..getPlayerName(player).."', `dmRak`='0', `raceRank`='0', `ddRank`='0', `trialsRank`='0', `runRank`='0'") Any ideas why I keep getting "Attempt to call a string value" here...? Thanks.
  13. Lol I forgot I can use "ipairs".. Thanks a lot!
  14. So I store player's account names into a JSON table like this: "[[user1, User2]]" and I want to check if the player's account name is in the table, something like... local theTable = fromJSON(owners) if isPlayerAccountInTable(thePlayer, theTable) then Thanks
  15. So I use this getRealTime function to get the date and time when the player logs in, but it returns some weird date: 28-2-116 21:21:14 I don't think this is the time of the host, but I am not sure. function getTheTime() local timeDate = getRealTime() local year = timeDate.year local month = timeDate.month local monthday = timeDate.monthday local hour = timeDate.hour local minute = timeDate.minute local second = timeDate.second return monthday.."-"..month.."-"..year.." "..hour..":"..minute..":"..second end Any ideas? Thanks.
  16. I've used that method before and it worked. That should return whatever the function returns. But in this case it only returns false...
  17. Thanks a lot! We have just updated the topic as we just finished working on version 0.3 Pre-Alpha!
  18. Hello guys, so I have this function which checks if the player has a sleeping bag placed in the world: function hasPlayerSleepingBag(thePlayer) if thePlayer then local account = getAccountName(getPlayerAccount(thePlayer)) local result = db:query("SELECT owner FROM sleepingbags") if result then if account == result[1]['owner'] then return true end else return false end end end addEvent("hasPlayerSleepingBag", true) addEventHandler("hasPlayerSleepingBag", getRootElement(), hasPlayerSleepingBag) Now, I need to use this function client side, so I made this: function hasPlayerSleepingBag(thePlayer) triggerServerEvent("hasPlayerSleepingBag", thePlayer, thePlayer) end The problem is... it doesn't work -.- I did this quick test: function teestFunc() if hasPlayerSleepingBag(getLocalPlayer()) then outputChatBox("YES") else outputChatBox("NO") end end addCommandHandler("test11", teestFunc) And it always outputs NO, but server side it outputs YES... Any ideas? Thanks.
  19. Lol, that was really useful, thanks a lot! Now it works like a charm
  20. I managed to solve it. It was because I used guiCreateMemo which adds a space at the end regardless of what I am doing to the word. So I switched to guiCreateEdit and it works fine.
  21. Doesn't matter Managed to do it myself.
  22. Is there a way to remove the detonator from satchel and add a timer? Thanks.
  23. Fucking finally someone to point me in the right direction! Now that I fixed the double clicking, what other event should I use?
×
×
  • Create New...