Jump to content

jkub

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by jkub

  1. I am collabing a script with a friend which makes improvements to the rustler. I was wondering if there was a function that gets the view of the player while there in a vehicle I.E. first person, close, far, cinematic view I need this for making a crosshair show up only when you are in the cockpit view of the rustler
  2. Thanks guys. I have most of my weapon shop going and it seems to be working well. I got the tables in right and it's beautiful. Just need to find a way to write receipts. I'll post some code later. I'm typing from an iPod right now lol
  3. Thank you I just tried out that code and had to correct what seems to be a typo "isnumber"? to tonumber. Anyway thank you very much I'm going to see if I can "weave" this into my shop code to see if it works Ill get back later
  4. I have sit for at least an hour and found no good way of making my purchase button work in this new ammunation gui/shop I am working on. Everything that I want to buy is added into a shopping cart ( gridlist ) and I obviously can't loop through the table because it wants a table and guiGridListGetRowCount does not return a table. (Correct if im wrong please, I am trying to learn ) Unless I was to define rows in a gridlist as a custom element type I might be able to loop through them but I have no clue how to do that. Here is a picture so you get the idea of what I am trying to do. I have tried making a table like selectedWeapons = {} then when a weapon is added to the cart I tried inserting those weapons into the table via table.insert which from what I understand is table.insert ( table, position, value ) I tried defining a position and leaving the position out and either way it seemed to overwrite the entire table to the last weapon that I inserted into the table. I used table.maxn to get the end of the table (I did some research and from what I understand it gets the table length) So I tried table.insert ( selectedWeapons, table.maxn(selectedWeapons)+1, weaponID ) that still rewrote the table and gave me one value regardless of how many weapons I had in my shopping cart
  5. Yea, thats what I thought. When it passes me those errors I use the admin panel to spectate them and see if they are even spawned. Turns out they are fully spawned and playing the game free to get vehicles and what not. I don't see how this is happening. Sometimes pictures can help, if not then explain better then words Here is the panel before I open up the clipboard. Here is the clipboard open and displaying my information Here is the clipboard when I open it for someone else and try to get their information. If you notice it is blank and there is a debug returned in my debug window The debug says bad argument @ getWeaponNameFromID but somehow it still returns the correct value when I use it on other players. Now it just seems to work for some people and not for others... thats what I don't understand I have one long guiSetText line for filling out the clipboard and I have tried defining values before to shorten it up but when I define getWeponNameFromID it always says that in debug and returns a blank clipboard.
  6. Thanks a million. That seemed to work. There is a section in my refined code where I get a "Clipboard" of information on whoever I am selecting in the playerlist. It works for the most part but there are players that when I have them selected it sometimes floods my chatbox returning nil values. This mainly happens with players who have just joined the server. Is that because that player is not done downloading the resources yet?. I know about the isTransferBoxActive function but I only know how to use that on the local client. If this actually is the case how would I use that function for that client I am selecting and return rather he is downloading or not.
  7. This sounds like it could be a problem where the script was made in 1.0.3 and when used in your 1.0.4 server it may not work due to some of the functions in the script being deprecated. A simple and first look solution would be going into your server and typing /upgrade ======================== Really nice update MTA Team. Thank you for this MOD. Hope to see more
  8. Tryed that. Failed. I got extremely fed up and cleaned out completely, all the functions that would either add change or delete insertions in the gridlist of my script and redid them. Here is what I have now. Players don't seem to be removed properly? --client function onClientResourceStart() initGUI() initReason() initSlapModifier() addEventHandler ( "onClientGUIClick", adminPanel, clickHandler ) addEventHandler ( "onClientGUIClick", reasonWindow, clickHandler2 ) addEventHandler ( "onClientGUIClick", slapModifierWindow, clickHandler3 ) -- triggerServerEvent ( "clientDownloadComplete", getLocalPlayer() ) -- end addEventHandler ( "clientServerInteractionComplete", getRootElement(), function ( IP, serial ) local tempRow = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, tempRow, playerColumn, getPlayerName ( source ), false, false ) guiGridListSetItemText ( playerList, tempRow, IPColumn, IP, false, false ) guiGridListSetItemText ( playerList, tempRow, serialColumn, serial, false, false ) end ) addEventHandler ( "onClientPlayerQuit", getRootElement(), function ( element ) local id = 0 while ( id <= guiGridListGetRowCount ( playerList ) ) do if ( guiGridListGetItemText ( playerList, id, playerColumn ) ) == getPlayerName ( source ) then guiGridListRemoveRow ( playerList, id ) end end id = id + 1 end ) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), function ( oldNick, newNick ) local id = 0 while ( id <= guiGridListGetRowCount( playerList ) ) do if ( guiGridListGetItemText ( playerList, id, playerColumn ) == oldNick ) then guiGridListSetItemText ( playerList, id, playerColumn, newNick, false, false ) end id = id + 1 end end ) --server --Server addEvent ( "clientDownloadComplete", true ) addEventHandler ( "clientDownloadComplete", getRootElement(), function() triggerClientEvent ( getRootElement(), "clientServerInteractionComplete", client, getPlayerIP ( client ), getPlayerSerial ( client ) ) end )
  9. I look through the function list quite often... Look again; according to the page, that function clears ALL the data from a gridlist. Thanks. I will try this. I will get back ASAP
  10. dammit... scratch that. I removed the one for when players join the server and wanted to use only the one that uses resource start and now it only adds players when the resource is started... The only way I could think of is use both of them, and check if each one of the row for the player it is trying to insert, already exists, however I have tried that several different ways and all that I have tried fail horribly. EDIT* This is getting to be alot bigger problem because now I discovered that since I looped that for every player that enters the server it will make an insertion for EVERYONE who it looped through. so if there was a total of 15 players in my server then I would have 15 insertions in the list of my self and 15 insertions of each and every other person. Damn this is a bigger problem then I thought. Please help me At the time of this picture I had just me and 1 other player in my server. It did this Here is what it also seems to be doing
  11. Works> Thanks:) Only Problem now is that If the player was to reconnect their would be a duplicate insertion in the gridlist. Here is the one for the resource start. addEventHandler ( "clientResComplete", getRootElement(), function ( player, IP ) for k, player in pairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, playerColumn, getPlayerName ( player ), false, false ) guiGridListSetItemText ( playerList, row, IPColumn, IP, false, false ) end end ) Here is the one for when a player joins the server function playerJoinHandler ( IP, name, serial ) local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, playerColumn, name, false, false ) guiGridListSetItemText ( playerList, row, IPColumn, IP, false, false ) end It just now hit me... If I make insertions both when a player joins and when the resource starts ( Triggered when a player joins anyway since it is "onClientResourceStart" ) then shouldn't I just remove one of these functions?
  12. Basicly What I am trying to do here is add every player in the server to a grid list in an admin panel I'm working on. I seemed to have it working for when a player quits and when he joins but in the middle of play when the resource starts is what I can't get here is my current code from doing client>server>client:work addEventHandler ( "clientResComplete", getRootElement(), function ( player, IP ) local id = 0 while ( id <= guiGridListGetRowCount( playerList ) ) do if ( guiGridListGetItemText ( playerList, id, playerColumn ) == getPlayerName ( player ) ) then -- if it makes it this far then from what I understand an insertion is not need due to their already being one that exists end--I can't turn this into an "else" id = id + 1 --Have to have this here in order to keep looking through the gridlist if I move it I get "Aborted: Infinite running script" end end )
  13. Oh. I cannot use onClientResourceStart alone. But are you trying to say it should be like: Client >>>> Server >>>> Client: Work
  14. Greetings I come to you this time in question why my server says that a client side event is not added client side even though I have checked more then 4 times and made sure that there was an event added. -server addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function() triggerClientEvent ( getRootElement(), "resStart", getRootElement(), source ) end ) -client addEvent ( "resStart", true )
  15. Thanks:) But now If I delete any vehicle before saving the map I get flooded with errors and it doesent save right. If I save the map without ever removing any vehicles it works fine. So I assume the problem lies in my remove function somewhere. I have a bogus way of getting the correct vehicle in the remove function so I wonder may that have something to do with it? function cmdSelectVehicle ( player, cmd, selID ) num = tonumber(selID) if selMarker then outputChatBox ( "*You must either save or delete the current vehicle you are working on*", player, 255, 0, 0 ) else if car[num] then local selectedVeh selectedVeh = car [tonumber(selID)].car local x, y, z = getElementPosition ( selectedVeh ) selMarker = createMarker ( x, y, z, "arrow", 2, 255, 255, 0, 125, getRootElement() ) attachElements ( selMarker, selectedVeh, 0, 0, 5 ) outputChatBox ( "*You have selected ( vehicle index: #FFFFFF" ..tonumber(selID).. "*", player, 0, 255, 0, true ) else outputChatBox ( "*You have selected an invalid vehicle index*", player, 255, 0, 0 ) end end end addCommandHandler ( "sel", cmdSelectVehicle ) function cmdRemoveVehicle ( player, cmd ) if cmd == "del" then if selMarker then local selectedVeh selectedVeh = getElementAttachedTo ( selMarker ) destroyElement ( selectedVeh ) destroyElement ( selMarker ) selMarker = nil carCount = carCount - 1 outputChatBox ( "*Vehicle deleted*", player, 0, 255, 0 ) else outputChatBox ( "*You have no vehicle selected to delete*", player, 255, 0, 0 ) end end end addCommandHandler ( "del", cmdRemoveVehicle ) addCommandHandler ( "save", function ( player, cmd, name ) if cmd == "save" then if selMarker then outputChatBox ( "You are currently editing a vehicle you must save the vehicle before you can save the map", player, 255, 0, 0 ) else if name == nil then outputChatBox ( "You need to specify a name for your vehicle map before you can save it", player, 255, 0, 0 ) else file = fileCreate ( "output/" ..name.. "."..mode.."" ) if mode == "map" then fileWrite ( file, " \r\n" ) elseif mode == "lua" then fileWrite ( file, "--File Generated with Dr.PhillyBlunt's Experimental Vehicle Mapper and Mapped by " ..getPlayerName(player).. "\r\n" ) end local count = 0 if mode == "lua" then fileWrite ( file, "local car = {} \r\n" ) else fileWrite ( file, '\r\n' ) end for _,v in pairs ( car ) do if v.car then outputChatBox ( "V.car has been found", player, 0, 255, 0 ) count = count + 1 local vx, vy, vz = getElementPosition ( v.car ) local rx, ry, rz = getVehicleRotation ( v.car ) local color1, color2, color3, color4 = getVehicleColor ( v.car ) local dimension = getElementDimension ( v.car ) local interior = getElementInterior ( v.car ) local vehName = getVehicleName ( v.car ) local realID = getVehicleModelFromName ( vehName ) if mode == "map" then fileWrite ( file, '') ('..count..')" color="'..color1..','..color2..','..color3..','..color4..'" dimension="'..dimension..'" interior="'..interior..'" model="'..realID..'" plate="GTASA" posX="'..vx..'" posY="'..vy..'" posZ="'..vz..'" rotX="'..rx..'" rotY="'..ry..'" rotZ="'..rz..'" upgrades=""/> \r\n' ) elseif mode == "lua" then fileWrite ( file, "car[" ..count.. "] = createVehicle ( " ..realID.. ", " ..vx.. ", " ..vy.. ", " ..vz.. ", " ..rx.. ", " ..ry.. ", " ..rz.. " ) -- " ..vehName.. " ) \r\n" ) fileWrite ( file, "setVehicleColor ( car[" ..count.. "]," ..color1.. ", " ..color2.. ", " ..color3.. ", " ..color4.. " ) \r\n" ) end end end if mode == "map" then fileWrite ( file, "" ) end fileClose ( file ) outputChatBox ( "File processed and saved as #00FF00" ..name.. "#0000FF."..mode.."", player, 255, 255, 255, true ) end end end end )
  16. Yes. I think I am trying to make carCount the number of cars in the table. Here is alot more code. I post functions for saving removing and selecting vehicles. I do not know how to properly "select" another vehicle from the table for "editing" without overwriting values as you said. local carCount = 0 maxCarCount = 50 car = {} function cmdAddVehicle ( player, cmd, vehicleName ) if cmd == "add" then if selMarker then outputChatBox ( "You are already editing a vehicle... save your current", player, 255, 0, 0 ) else if vehicleName == nil then outputChatBox ( "You need to specify a vehicle name in order to create a vehicle", player, 255, 0, 0 ) else local pX, pY, pZ = getElementPosition ( player ) local pRZ = getPedRotation ( player ) if carCount <= maxCarCount then carCount = carCount + 1 car[carCount] = {} car[carCount].car = createVehicle ( getVehicleModelFromName(vehicleName), pX, pY + 5, pZ + 1, 0, 0, pRZ ) setElementData ( car[carCount].car, "owner", player ) local x, y, z = getElementPosition ( car[carCount].car ) selMarker = createMarker ( x, y, z, "arrow", 2, 255, 255, 0, 125, getRootElement() ) attachElements ( selMarker, car[carCount].car, 0, 0, 5 ) if car[carCount].car then outputChatBox ( "You have created a " ..vehicleName.. " (Vehicle Index: #FFFFFF" ..carCount, player, 0, 255, 0, true ) local model = getVehicleModelFromName (vehicleName) if model == 577 or model == 447 or model == 460 then warpPedIntoVehicle ( player, car[carCount].car, 0 ) end end else outputChatBox ( "*You have reached the maximum limit of cars*", player, 255, 0, 0 ) end end end end end addCommandHandler ( "add", cmdAddVehicle ) function cmdRemoveVehicle ( player, cmd ) if cmd == "del" then if selMarker then destroyElement ( car[carCount].car ) car[carCount] = {carCount} destroyElement ( selMarker ) selMarker = nil carCount = carCount - 1 outputChatBox ( "*Vehicle deleted*", player, 0, 255, 0 ) else outputChatBox ( "*You have no vehicle selected to delete*", player, 255, 0, 0 ) end end end addCommandHandler ( "del", cmdRemoveVehicle ) function cmdSelectVehicle ( player, cmd, selID ) num = tonumber(selID) if selMarker then outputChatBox ( "*You must either save or delete the current vehicle you are working on*", player, 255, 0, 0 ) else if car[num] then car[carCount].car = car[num].car local x, y, z = getElementPosition ( car[carCount].car ) selMarker = createMarker ( x, y, z, "arrow", 2, 255, 255, 0, 125, getRootElement() ) attachElements ( selMarker, car[carCount].car, 0, 0, 5 ) outputChatBox ( "*You have selected ( vehicle index: #FFFFFF" ..tonumber(selID).. "*", player, 0, 255, 0, true ) else outputChatBox ( "*You have selected an invalid vehicle index*", player, 255, 0, 0 ) end end end addCommandHandler ( "sel", cmdSelectVehicle ) function saveTheCar ( player, cmd ) if selMarker then destroyElement ( selMarker ) selMarker = nil outputChatBox ( "*Vehicle Saved*", player, 0, 255, 0 ) end end addCommandHandler ( "savecar", saveTheCar )
  17. I've since then fixed that from selid to selID and still does the same thing. Like you said I can't understand why most of it work but the last insertion in the table is missing. Could it be the "carCount" thing? I know that that value is manipulated several places in the script. Do I need to post any more code? EDIT: Any time I select an index that isn't valid It will tell me via script and perhaps a line in the debug but always the last vehicle I select in the table it says nothing in debug almost as if it was perfect.
  18. Hello. I have released a command based vehicle mapper a while back on the resource page and yesterday made a major working update to it. Today I wanted to release another update. This one I am working on now gives you the ability to destroy vehicles from the map and select other vehicles you have previously saved into the map. For the most part this works BUT I have a big problem nonetheless. Its kind of hard to explain so I will make an example 1.I add 5 banshees using the mapper and save them into the map. 2.Since I currently have no vehicles selected I will start selecting other vehicles. So I select vehicle 1 from the table, then 2, then 3, then 4, ... here is the problem. When I try to select my last vehicle ( Vehicle 5 ) it selects vehicle 4. Its like I never have created a 5th vehicle. And when I save the whole map to a map or lua file the last 2 vehicles are ALWAYS duplicate of the vehicle before the last. Same positions model color etc. Here is some code function cmdSelectVehicle ( player, cmd, selID ) num = tonumber(selid) if selMarker then outputChatBox ( "*You must either save or delete the current vehicle you are working on*", player, 255, 0, 0 ) else if car[num] then car[carCount].car = car[tonumber(selID)].car local x, y, z = getElementPosition ( car[carCount].car ) selMarker = createMarker ( x, y, z, "arrow", 2, 255, 255, 0, 125, getRootElement() ) attachElements ( selMarker, car[carCount].car, 0, 0, 5 ) outputChatBox ( "*You have selected vehicle index: " ..tonumber(selID).. " *", player, 0, 255, 0 ) else outputChatBox ( "*You have selected an invalid vehicle index*", player, 255, 0, 0 ) end end end addCommandHandler ( "sel", cmdSelectVehicle )
  19. We can't get anything for your stolen client side script This is stolen
  20. Sounds great. 1 MTA Wins 2. MTA Pwns SA-MP Great work guys keep it up. I hope this mod sees much success
  21. sorry to budge through here like this but I feel my next question is of high relevence... If I don't know the correct offset positions for attaching a small object just above the hood of a car, is there a function that lets me get "would be" offsets of any objects within a small vicinity of the car?
  22. Oh my G!!!! Thank you so much!. Im gonna be playing with this for a good while. I appreciate the help:) Lot of advanced stuff for me though
  23. Would it be too much stress on the server or client to use onClientRender to draw the dxLines? I usually use that for a lot of things now days and I am never able to remove the even right. even though I use removeEventHandler ( "onClientRender", getRootElement(getLocalPlayer()), whateverTheFunctionIs ) Later in the debug it always seems to stay and it says that onClientRender is already handled. any thoughts?
  24. #2 I mean like static of an old tv. Sorry I coulden't find a good example but this just about sums up what I mean. This guy put this visual static effect on his video.VV
×
×
  • Create New...