Jump to content

jkub

Members
  • Posts

    342
  • Joined

  • Last visited

Everything posted by jkub

  1. As we all know (Or hopefully know) by now, their have been an uncountable number of noobs uploading car mods to the resource download page. Most of them (if not all) are just copied scripts with changed directories leading to the model and texture files. This is getting to become a giant problem and I believe soon that if it is not stopped, the majority of resources on the resource download page will be stolen car mods. Please that is not what that website is for. Admins, please do something about this, I am begging you...
  2. I have a couple more problems lol. 1. It does not detect vehicles 2. Whenever the ray does detect an obstruction in the way, after deaccelerating and braking, I cannot disengage the brake... I used setControlState to disable the accel and enable the brake when something is detected but everytime after stopped, I have to manually press the brake or handbrake to release it. I have had this problem setControlState before.
  3. Thanks greatly varez Aside from the z problem I can't currently seem to get to the mta wiki for the arguments for lineOfSightClear and the others. Ill try this out.
  4. I have made a cruise control script a long time ago and I was working to upgrade it today to be able to process lines of sight in front of it to be able to adjust speed to not hit anything. I understand it would be tactical to use processLineOfSight or isLineOfSightClear but the problem with that is I don't know how to calculate distance in front of a vehicle to get the end points. My major weakness is applying advanced math (I barely even know) and trigonometric functions in order to calculate space in front of the vehicle. Here is some code. function cruiseOn() if isPedInVehicle ( getLocalPlayer() ) then if getVehicleController ( getPedOccupiedVehicle ( getLocalPlayer() ) ) == getLocalPlayer() then local vehX, vehY, vehZ = getElementVelocity ( getPedOccupiedVehicle ( getLocalPlayer() ) ) local vx, vy, vz = getElementPosition ( getPedOccupiedVehicle ( getLocalPlayer() ) ) local vrot, vrot, vrot = getVehicleRotation ( getPedOccupiedVehicle ( getLocalPlayer() ) ) local realSpeed = ( vehX^2 + vehY^2 + vehZ^2 ) ^ ( 0.5 ) local sX, sY = guiGetScreenSize() local pX, pY = guiGetPosition ( panel, false ) local sizeX, sizeY = guiGetSize ( panel, false ) ---- dxDrawImage ( pX, pY, sizeX, sizeY, "images/cruiseOn.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), true ) --dxDrawLine3D ( vx, vy, vz, endx, endy, endz, tocolor ( 255, 0, 0, 100 ), 4, true, 0 ) if realSpeed < cruise_Speed then setControlState ( "accelerate", true ) else setControlState ( "accelerate", false ) end end else removeEventHandler ( "onClientRender", getRootElement(), cruiseOn ) cruise = nil cruise_Speed = nil setControlState ( "accelerate", false ) if cruise == nil then cruiseControlStatus = nil end end end
  5. His router is a 2 wire 2701HG-B.
  6. I have even tried connecting to it myself via quick connect, still nothing.
  7. I have a friend who is trying to set up a public mta server on his home computer. The server is not showing up in the game monitor browser list. I understand that this is a common problem upon trying to get servers public, but we have tried everything from manual port forwarding to opening all ports at once. We tried changing several things throughout the mtaserver.conf file and nothing seems to get this to work. Can you please help us to get this working and public? I appreciate any help we can get, thanks. Here is the conf file <config> <!-- This parameter specifies the name the server will be visible as in the ingame server browser and on Game-Monitor. It is a required parameter. --> <servername>ROLLABLUNT</servername> <!-- ONLY USE THIS PARAMETER IF YOU ARE SURE OF WHAT YOU ARE DOING - it is generally only needed for professional servers and should be left blank otherwise. This parameter specifies the IP to use for servers that have multiple IP addresses. If left blank, it will default to server's standard local IP address. --> <serverip></serverip> <!-- This parameter specifies the Maximum Transmission Unit or maximum packet size that the server will use. This will depend on the nature of your clients, as well as the network medium your server is connected to. --> <mtusize>1500</mtusize> <!-- This parameter specifies the UDP port on which the server will be accepting incoming player connections; default value: 22003. It is a required parameter. --> <serverport>22003</serverport> <!-- This parameter specifies the number of maximum player slots available on the server; default value: 32. It is a required parameter. --> <maxplayers>12</maxplayers> <!-- This parameter specifies whether the builtin http server will be used. Values: 0 - disabled , 1 - enabled ; default value: 1. Optional parameter. --> <httpserver>1</httpserver> <!-- This parameter specifies the TCP port on which the server will be accepting incoming http connections. It can be set to the same value as <serverport>. It is a required parameter if <httpserver> is set to 1. --> <httpport>22003</httpport> <!-- If set, this parameter specifies the external URL from which clients will be able to download needed resources ingame. Otherwise they will download them directly from the server. --> <httpdownloadurl></httpdownloadurl> <!-- This parameter specifies whether the client files for hosting on an external web server should be automatically copied into mods/deathmatch/resource-cache/http-client-files/ Only relevant if <httpdownloadurl> is set. Values: 0 - disabled , 1 - enabled ; default value: 1. Optional parameter. --> <httpautoclientfiles>1</httpautoclientfiles> <!-- This parameter limits the number of http connections each client can make. If you are using an external Apache web server, a lower figure such as 8 may be required to avoid download timeouts. A streamlined web server such as lighttpd, would benefit from the maximum setting of 32. (Note: If set to less than 32, pre 1.0.3 clients will be diverted to use MTA's inbuilt web server) Available range: 2 to 32. --> <httpconnectionsperclient>32</httpconnectionsperclient> <!-- This parameter specifies what types of checks the clients should make to ensure there has been no tampering with certain settings. Values: 0 - disabled , -1 - everything. default value: -1. --> <verifyclientsettings>0</verifyclientsettings> <!-- Comma seperated list of disabled anti-cheats. e.g. To disable anti-cheat #2 and #3, use: 2,3 --> <disableac></disableac> <!-- Minimum client version. Clients with a lower version will not be allowed to connect. After disconnection, clients will be given an opportunity to download an update (if their client supports auto-update). If left blank, this setting is disabled and there are no restrictions on who can connect. Version numbers look like this: 1.0.4-9.01746.0 --> <minclientversion></minclientversion> <!-- Recommended client version. When connecting, if clients have a lower version, they will be given the option to download an update (if their client supports auto-update). If left blank, this setting is disabled. --> <recommendedclientversion></recommendedclientversion> <!-- This parameter can be used to make the server report to Game-Monitor master servers, allowing it to be visible in the ingame server browser. An additional UDP port needs to be available for this to work (value from <serverport> + 123 , so on a default <serverport> value 22003 the right port will be 22126 ). Available values: 0 - disabled , 1 - enabled. Optional parameter, defaults to 0. --> <ase>1</ase> <!-- This parameter allows you to disable LAN broadcasting. --> <donotbroadcastlan>0</donotbroadcastlan> <!-- If set, players will have to provide a password specified below, before they can connect to the server. If left blank, server doesn't require a password from them. --> <password></password> <!-- Specifies the location and name of the main server log file. If left blank, server won't be saving this file. --> <logfile>logs/server.log</logfile> <!-- As well as the main log file, login successes and failures are logged here for easy reviewing of security issues. If left blank, this file is not used --> <authfile>logs/server_auth.log</authfile> <!-- This parameter specifies the location and name of the Access Control List settings file. If left blank, server will use acl.xml file, located in the same folder as this configuration file. --> <acl>acl.xml</acl> <!-- Specifies the location and name of the debugscript log file. If left blank, server won't be saving this file. --> <scriptdebuglogfile>logs/scripts.log</scriptdebuglogfile> <!-- Specifies the level of the debugscript log file. Available values: 0, 1, 2, 3. When not set, defaults to 0. --> <scriptdebugloglevel>0</scriptdebugloglevel> <!-- Specifies the level of the html debug. Available values: 0, 1, 2, 3. When not set, defaults to 0. --> <htmldebuglevel>0</htmldebuglevel> <!-- Specifies the server frames limit. Minimum value: 25, default: 36. --> <fpslimit>60</fpslimit> <!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module> parameter(s). Optional parameter. --> <!-- <module src="sample_win32.dll"/> --> <!-- <module src="sample_linux.so"/> --> <!-- Specifies resources that are loaded when the server starts and/or which are protected from being stopped. To specify several resources, add more <resource> parameter(s). --> <resource src="admin" startup="1" protected="0"/> <resource src="helpmanager" startup="1" protected="0"/> <resource src="joinquit" startup="1" protected="0"/> <resource src="defaultstats" startup="1" protected="0"/> <resource src="mapcycler" startup="1" protected="0"/> <resource src="mapmanager" startup="1" protected="0"/> <resource src="parachute" startup="1" protected="0"/> <resource src="resourcebrowser" startup="1" protected="1" default="true"/> <resource src="resourcemanager" startup="1" protected="1"/> <resource src="scoreboard" startup="1" protected="0"/> <resource src="spawnmanager" startup="1" protected="0"/> <resource src="votemanager" startup="1" protected="0"/> <resource src="webadmin" startup="1" protected="0"/> <!-- play is the default freeroam gamemode. Remove the following line to prevent it from starting. --> <resource src="play" startup="1" protected="0"/> </config>
  8. I am phillyblunt the creator of the rocket cars script. I will try to help you. The default global variable I used in this seems to be fuelAmmount. Try a command that makes you able to restore fuel. For example addCommandHandler ( "fuel", function ( cmd, fuel ) if fuel then if tonumber(fuel) then fuelAmmount = tonumber(fuel) end end end ) I am not entirely sure on what you are wanting to accomplish, but this should be a simple way to restore fuel.
  9. BUMP: TBH after weeks of staring and referencing myself to MTAs wiki and the lua manual I didn't understand much of what you did 50p. I was never really able to manipulate weapons, skins etc with it. I changed up the structure of the gangList a little bit and have snipped and rewrote a bit of the script. With the current state of the system I am able to give the weapons to their gangs but if I try to spawn the player at their base I get a "c stack overflow" error in debug. I have researched this and I understand I am getting this error because it is causing an infinite loops aka a player first spawns and then the function spawns him again on and on and on... I tried changing up the script a bit to where the person is spawned, given weapons and skins as soon as they log in but that failed. You know of any other ways to do this without changing xml structure? Here is my current gangList.xml I grayed out skin and vehicles because I wanted to make sure the spawns and weapons worked first (which they do not at the same time due to the loop). Here is my current lua g_Teams = { }; -- a global table for teams and their data function initTeams( ) local gangsRoot = xmlLoadFile( "gangList.xml" ); for i, gangNode in ipairs( xmlNodeGetChildren( gangsRoot ) ) do -- loop all the nodes team = { createTeam( xmlNodeGetAttribute( gangNode, "name" ), 255, 255, 255 ) }; -- create a team and store it in a table table.insert( g_Teams, team ); -- insert team table to the global teams table end end function playerSpawnCheck() local account = getPlayerAccount ( source ) if isGuestAccount ( account ) == false then local gangsRoot = xmlLoadFile ( "gangList.xml" ) for i, gangNode in ipairs ( xmlNodeGetChildren ( gangsRoot ) ) do for j, child in ipairs ( xmlNodeGetChildren ( gangNode ) ) do for k, childNode in ipairs ( xmlNodeGetChildren ( child ) ) do local memberName = xmlNodeGetAttribute ( childNode, "name" ) if memberName == false then outputChatBox ( "*Error in finding name attribute in child node: Check the ganglist for mistakes" ) else local myAccountName = getAccountName ( account ) if myAccountName == memberName then setPlayerTeam ( source, getTeamFromName ( xmlNodeGetAttribute ( gangNode, "name" ) ) ) ---- local gangName = xmlNodeGetAttribute ( gangNode, "name" ) local weaponNode = xmlFindChild ( gangNode, "weapons", 0 ) local spawnNode = xmlFindChild ( gangNode, "spawn", 0 ) local gangWeapons = xmlNodeGetAttributes ( weaponNode ) spawnX = xmlNodeGetAttribute ( spawnNode, "posX" ) spawnY = xmlNodeGetAttribute ( spawnNode, "posY" ) spawnZ = xmlNodeGetAttribute ( spawnNode, "posZ" ) rotation = xmlNodeGetAttribute ( spawnNode, "rot" ) ---- for k, v in pairs ( gangWeapons ) do addWeaponToInventory ( source, tonumber(v) ) end end end end end end xmlUnloadFile ( gangsRoot ) end --spawnPlayer ( source, spawnX, spawnY, spawnZ, rotation ) end function addWeaponToInventory ( player, weapon ) if weapon >= 0 and weapon <= 9 or weapon >= 10 and weapon <= 15 then ammo = 0 elseif weapon == 22 or weapon == 23 then--colt45,silenced ammo = 68--4 mags elseif weapon == 24 then--deagle ammo = 35--5 mags elseif weapon == 25 then--shotgun ammo = 24--24 shells elseif weapon == 26 then--sawed off ammo = 32--32 shells elseif weapon == 27 then--combat shotty ammo = 49--7 clips(49 shells) elseif weapon == 28 or weapon == 32 then--Uzi,tec-9 ammo = 250 elseif weapon == 29 then--mp5 ammo = 150 elseif weapon == 30 then--ak ammo = 320 elseif weapon == 31 then--m4 ammo = 250 elseif weapon == 33 then--rifle ammo = 18 elseif weapon == 34 then--sniper ammo = 16 elseif weapon == 16 or weapon == 17 or weapon == 18 or weapon == 39 then--projectiles (nades, molotovs, tear gas, satchels) ammo = 6 end giveWeapon ( player, weapon, ammo ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource()), initTeams ) addEventHandler ( "onPlayerSpawn", getRootElement(), playerSpawnCheck ) I appreciate any help given. Thanks
  10. I have done this before but only try it if you know what you are doing. I remember long ago when I was using the mta script editor and I had this problem all of the sudden. But somewhere in the system registry is a value for the script editor that points to where the resources folder is for MTA. You can manually edit it. If I find the location in the registry later I will post back here.
  11. I read through the whole page and at no time did I see anything saying your applicants will be paid in $. I am certainly not the best scripter around but am certainly not the worst either. Many of the people on this forum will not dedicate theirselves to this project because they want $$$ for their services or are too busy caught up in their own projects. Regardless of my skills I may be interested in working for you, of course as long as it PAYS $$$
  12. I'm not sure I'm in an obligative position to say this but I will go ahead and say it anyway. How come every time when people request scripts and don't offer pay, that you guys tell them without pay it will not be done, but when someone actually offers money you guys turn them down like their some kind of fool?
  13. Of course lol... Well I got a new code through a loop like you said. It seems to work perfectly Here it is: g_Teams = { }; -- a global table for teams and their data function initTeams( ) local gangsRoot = xmlLoadFile( "gangList.xml" ); for i, gangNode in ipairs( xmlNodeGetChildren( gangsRoot ) ) do -- loop all the nodes team = { createTeam( xmlNodeGetAttribute( gangNode, "name" ), 255, 255, 255 ) }; -- create a team and store it in a table for j, child in ipairs( xmlNodeGetChildren( gangNode ) ) do -- loop all the gang children: weapons, skins, etc. local nodeName = xmlNodeGetName( child ); if nodeName == "weapons" then -- check if the node name is "weapons" if so, get the weapon ids from its "ids" attribute local weaponsStr = xmlNodeGetAttribute( child, "ids" ); -- this will return ids as a string from "ids", like: "1,2,3,4,5,6" team.weapons = split( weaponsStr, string.byte( "," ) ); -- returns a table with all weapons in separate index of the table... check split func on wiki for more info elseif nodeName == "skins" then -- do exactly the same as for weapons end end table.insert( g_Teams, team ); -- insert team table to the global teams table end end function playerSpawnCheck() local account = getPlayerAccount ( source ) if isGuestAccount ( account ) == false then local gangsRoot = xmlLoadFile ( "gangList.xml" ) for i, gangNode in ipairs ( xmlNodeGetChildren ( gangsRoot ) ) do for j, child in ipairs ( xmlNodeGetChildren ( gangNode ) ) do for k, childNode in ipairs ( xmlNodeGetChildren ( child ) ) do local memberName = xmlNodeGetAttribute ( childNode, "name" ) if memberName == false then outputChatBox ( "*Error in finding name attribute in child node: Check the ganglist for mistakes" ) else local myAccountName = getAccountName ( account ) if myAccountName == memberName then setPlayerTeam ( source, getTeamFromName ( xmlNodeGetAttribute ( gangNode, "name" ) ) ) end end end end end xmlUnloadFile ( gangsRoot ) end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource()), initTeams ) addEventHandler ( "onPlayerSpawn", getRootElement(), playerSpawnCheck ) Thank you so much 50p!
  14. From what you provided I somewhat understand and was able to come up with a rather ludicrous way to loop through all members. function playerSpawnCheck() local account = getPlayerAccount ( source ) if isGuestAccount ( account ) == false then local gangsRoot = xmlLoadFile ( "gangList.xml" ) for i, gangNode in ipairs ( xmlNodeGetChildren ( gangsRoot ) ) do for j, child in ipairs ( xmlNodeGetChildren ( gangNode ) ) do local nodeName = xmlNodeGetName( child ); --outputChatBox ( "hax1" ) if nodeName == "members" then --outputChatBox ( "hax" ) thisChild = xmlFindChild ( child, "member", 0 ) thisChild2 = xmlFindChild ( child, "member", 1 ) thisChild3 = xmlFindChild ( child, "member", 2 ) thisChild4 = xmlFindChild ( child, "member", 3 ) if thisChild or thisChild2 or thisChild3 or thisChild4 then local name = xmlNodeGetAttribute ( thisChild, "name" ) local name2 = xmlNodeGetAttribute ( thisChild2, "name" ) local name3 = xmlNodeGetAttribute ( thisChild3, "name" ) local name4 = xmlNodeGetAttribute ( thisChild4, "name" ) if name or name2 or name3 or name4 then local myAccountName = getAccountName ( account ) if myAccountName == name then setPlayerTeam ( source, getTeamFromName ( xmlNodeGetAttribute ( gangNode, "name" ) ) ) elseif myAccountName == name2 then setPlayerTeam ( source, getTeamFromName ( xmlNodeGetAttribute ( gangNode, "name" ) ) ) elseif myAccountName == name3 then setPlayerTeam ( source, getTeamFromName ( xmlNodeGetAttribute ( gangNode, "name" ) ) ) elseif myAccountName == name4 then setPlayerTeam ( source, getTeamFromName ( xmlNodeGetAttribute ( gangNode, "name" ) ) ) else -- end else outputChatBox ( "hax denied" ) end else outputChatBox ( "no hax" ) end end end end xmlUnloadFile ( gangsRoot ) end end You notice I have to manually ad the member1, member2 in. Is there another shorter more efficient way I can loop through any possible indexes?
  15. Thanks for the help n3m3s1s But I already explained on my server's forum that I made those outputChatBox functions when a player spawns so I could see that the gangs are actually found correctly. That is sort of how I debug sometimes so I could check and see if things actually exist. But from those pictures you posted above you can see that it obviously only loops through the first gang's members. ============================== @50p: For my first function that creates the team I get no errors. It loops through and creates the team. I made the XML myself and I of course am a noob at XML. I figured that it would go something like that. I'm not quite getting what your saying though. Can you show me how I should rewrite the XML or maybe a little example?
  16. I got a little bit further. I looked at the wiki long and hard and seemed to squeeze out a little bit. The code below only loops through the first gang I have in my xml file. So therefore it only works partially. However I have 3 gangs in the xml file and I need it to loop through all 3. teams = {} function resStartHandler() gangDatabase = xmlLoadFile ( "gangList.xml" ) if gangDatabase then local teamsXml = xmlNodeGetChildren ( gangDatabase ) for index, gangNode in ipairs ( teamsXml ) do teamElement = xmlNodeGetValue ( gangNode ) if teamElement then teams[index] = createTeam ( ""..teamElement.."", 255, 255, 255 ) else outputChatBox ( "*Failed to get value of a specific node" ) end end if gangDatabase then xmlUnloadFile ( gangDatabase ) end else outputChatBox ( "*Failed to load the ganglist database" ) end end function playerSpawnHandler() gangDatabase = xmlLoadFile ( "gangList.xml" ) if gangDatabase then local teamsXml = xmlNodeGetChildren ( gangDatabase ) for index, gangNode in ipairs ( teamsXml ) do teamElement = xmlNodeGetValue ( gangNode ) if teamElement then local account = getPlayerAccount ( source ) if isGuestAccount ( account ) == false then local accountName = getAccountName ( account ) outputChatBox ( teamElement ) hax = xmlFindChild ( gangDatabase, "members", 0 ) if hax then local attr = xmlNodeGetAttributes ( hax ) for name, value in pairs ( attr ) do if accountName == value then setPlayerTeam ( source, getTeamFromName ( teamElement ) ) end end end end end end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resStartHandler ) addEventHandler ( "onPlayerSpawn", getRootElement(), playerSpawnHandler ) Here is my XML. I don't really know what to put it in so I will just try some lua tags <gangs> <gang>Yakuzagang> <members member1="noobz" member2="1233321" /> <skins skin1="169" skin2="186" skin3="187" skin4="150" /> <vehicles vehicle1="429" vehicle2="461" vehicle3="402" /> <weapons weapon1="29" weapon2="24" weapon3="5" weapon4="31" weapon5="1" /> <gang>Deadlinegang> <members member1="[TMS]n3m3s1s" /> <skins skin1="114" skin2="115" skin3="116" /> <vehicles vehicle1="475" vehicle2="522" vehicle3="541" vehicle4="602" vehicle5="520" /> <weapons weapon1="24" weapon2="30" weapon3="28" weapon4="34" /> <gang>Policegang> <members member1="phil.jus91" member2="zeus" /> <skins skin1="280" skin2="281" skin3="282" skin4="283" skin5="284" skin6="285" skin7="288" /> <vehicles vehicle1="596" vehicle2="597" vehicle3="598" vehicle4="523" vehicle5="528" vehicle6="425" /> <weapons weapon1="24" weapon2="31" weapon3="3" weapon4="17" /> -- The team element goes in the gang node <members member1="ACCOUNTNAME" member2="ACCOUNTNAME" member3="ACCOUNTNAME" member4="ACCOUNTNAME" /> The names of the accounts go here <skins skin1="SKINID" skin2="SKINID" skin3="SKINID" skin4="SKINID" /> Skins for the gang go here <vehicles vehicle1="VEHICLEID" vehicle2="VEHICLEID" vehicle3="VEHICLEID" vehicle4="VEHICLEID" /> Vehicle IDs for the gang go here <weapons weapon1="WEAPONID" weapon2="WEAPONID" weapon3="WEAPONID" weapon4="WEAPONID" /> Weapon IDs for the gang go here --> gangs>
  17. Can someone please tell me how to tag XML so I can display it also?
  18. I just put my server up a couple of days ago and have been trying to work out all the bugs and implement scripts into my server. I have players in my server who want to be on a gang/team and I want to make an efficient system that handles creating the teams and setting those players on their teams according to their own account names. I store the team names and account names of the members in an XML file. I can do the scripting part where it gets the team names and creates the teams based on the XML. I can't seem to do the part that puts a player on his right team though. Can you help me please. Here is my LUA teams = {} function resStartHandler() gangDatabase = xmlLoadFile ( "gangList.xml" ) if gangDatabase then local teamsXml = xmlNodeGetChildren ( gangDatabase ) for index, gangNode in ipairs ( teamsXml ) do teamElement = xmlNodeGetValue ( gangNode ) if teamElement then teams[index] = createTeam ( ""..teamElement.."", 255, 255, 255 ) else outputChatBox ( "*Failed to get value of a specific node" ) end end else outputChatBox ( "*Failed to load the ganglist database" ) end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), resStartHandler ) This is only the part that gets the names from the xml and it DOES seem to work. For managing the player's teams I have tried looping through the teams table and checking a player's account name vs the account name of an attribute inside my xml but I seemed to fail. I don't have that code for that part anymore. I want to post my XML contents here but I don't know what tags to put it in?
  19. Your not giving enough information. We know there is something wrong with it, but what part of it ceases to function. Is there any debug errors or warnings?
  20. Thanks 50p and MaddDogg. Putting the coords in a table was a really good idea. The "playerSpawnedComplete" is for closing the GUI and hiding the cursor. It also is used to trigger a function from a seperate resource (My welcome window) which shows vital information, rules, etc... I put that in the server function instead of putting it clientside because I wanted to make sure the GUI does not close until the player is spawned, which obviously fails in several different languages. But I am wanting to keep it there for the sole purpose of triggering my welcome window. I used the table for my client side setCameraMatrices because I didn't see a problem with it and I thought as well that it would make the script cleaner and reduce repeating myself. Here is the revised part of the client script that matters addEvent ( "loginAttempt", true ) addEvent ( "closeLoginGUI", true ) addEvent ( "playerSpawnedComplete", true ) cameraCoords = { { 1170.7250, -1481.7625, 30.4994, 1131.1616, -1495.6624, 22.7690 }, --Verona Mall { 2193.6376, -1108.1195, 24.8521, 2205.5949, -1138.3500, 34.2421 }, --Jefferson Motel { 2442.3122, -1655.8826, 27.9151, 2510.4106, -1676.0703, 13.5468 }, --Grove Street { -1736.7707, 959.3780, 24.8828, -1838.4617, 906.7504, 49.3268 }, --Financial District Hotel { -2015.3387, 184.3074, 27.6875, -2034.9644, 166.5152, 30.9673 }, --Doherty Garage { -2580.9016, 1359.5323, 15.3211, -2614.8896, 1381.2315, 12.5663 }, --Jizzy's Pleasure Domes { 2132.0070, 1945.4909, 10.6828, 1979.1539, 1916.1916, 95.1458 }, --The Visage { 2397.0244, 1663.3498, 16.6667, 2367.6035, 1652.3618, 10.8203 }, --Last Resort Motel { 2036.9645, 1343.3657, 10.8203, 2010.3544, 1343.3742, 11.9886 } --The High Roller } function spawnClick ( button ) if button == "left" then if source == spawnButton then local row, col = guiGridListGetSelectedItem ( spawnList ) if row == -1 then outputChatBox ( "*You have to select a location to spawn first!", 255, 0, 0 ) else if isTransferBoxActive() == false then skin = math.random ( 0, 288 ) interior = 0 dimension = 0 team = user_Team triggerServerEvent ( "spawnWindow_SpawnPlayer", getLocalPlayer(), row, skin, interior, dimension, team ) else outputChatBox ( "*For stability/safety reasons, you need to wait for the resources to finish downloading before you spawn*", 255, 175, 0 ) end end elseif source == spawnList then local row, col = guiGridListGetSelectedItem ( spawnList ) if row == -1 then --no row was selected else x = cameraCoords[ row + 1 ][ 1 ] y = cameraCoords[ row + 1 ][ 2 ] z = cameraCoords[ row + 1 ][ 3 ] lookX = cameraCoords[ row + 1 ][ 4 ] lookY = cameraCoords[ row + 1 ][ 5 ] lookZ = cameraCoords[ row + 1 ][ 6 ] setCameraMatrix ( x, y, z, lookX, lookY, lookZ ) end end end end function openSpawnWindow ( success ) if success == true then guiSetVisible ( spawnWindow, true ) showCursor ( true ) end end function openSpawnWindowOnRegister() guiSetVisible ( spawnWindow, true ) showCursor ( true ) end function closeSpawnWindow() guiSetVisible ( spawnWindow, false ) showCursor ( false ) end addEventHandler ( "loginAttempt", getRootElement(), openSpawnWindow ) addEventHandler ( "closeLoginGUI", getRootElement(), openSpawnWindowOnRegister ) addEventHandler ( "playerSpawnedComplete", getRootElement(), closeSpawnWindow ) I had remembered from past scripts that rowIDs in a gridlist start at 0 and a table seems to start at 0. That is why I put the row + 1 in each variable. In order to sync them together< and here is the revised server side script addEvent ( "spawnWindow_SpawnPlayer", true ) local spawnLocations = { { 1130.0665, -1488.45678, 23, 0 }, --Verona Mall { 2223.3437, -1160.2365, 26, 0 }, --Jefferson Motel { 2512.5363, -1673.1607, 14, 74 }, --Grove Street { -1757.7215 , 957.9381, 25, 180 }, --Financial District Hotel { -2023.8781, 156.6600, 29, 270 }, --Doherty Garage { -2631.9372, 1381.6345, 8, 180 }, --Jizzy's Pleasure Domes { 2028.0147, 1916.1400, 13, 260 }, --The Visage { 2368.5908, 1660.3601, 11, 270 }, --Last Resort Motel { 1955.9962, 1342.9613, 16, 270 } --The High Roller } function server_SpawnClient ( rowID, skin, interior, dimension, team ) ---- x = spawnLocations[ rowID + 1 ][ 1 ] y = spawnLocations[ rowID + 1 ][ 2 ] z = spawnLocations[ rowID + 1 ][ 3 ] rot = spawnLocations[ rowID + 1 ][ 4 ] ---- setTimer ( spawnPlayer, 1000, 1, client, x, y, z, rot, skin, interior, dimension, team ) setTimer ( setCameraTarget, 1000, 1, client, client ) fadeCamera ( client, false, 1.0, 0, 0, 0 ) setTimer ( fadeCamera, 2000, 1, client, true, 3.0 ) triggerClientEvent ( client, "playerSpawnedComplete", client ) end addEventHandler ( "spawnWindow_SpawnPlayer", getRootElement(), server_SpawnClient )
  21. The serverside function is called from a client script, so thats where the client comes from. About the table thing> How would I use tables to do it? Thanks
  22. The fade camera functions are obviously for pure aesthetic purposes because I didn't like the plain old spawn. I use a timer for spawn player because I don't want the player spawning until the screen is completely black from the fade camera function. Then when the player is spawned, the camera fades back in. My reason for checking the players position as 0, 0, 0 is my asnine way of checking if the player is spawned or not, the significance behind that is that, after I call my spawnPlayer I wanted to make sure the player still was not stuck in the middle of the map falling. I later discovered the isPedOnGround which in turn didn't really help. I even tried looking into the play script for how it spawns its players. To my discovery it uses a "repeat" loop which seems to work every time. I tried using the same exact method and it is just affective as my other methods, it even has the occasional infinite running script error to where it bogs down the server and clients in the process. Here is a shitload of code from client side. function spawnClick ( button ) if button == "left" then if source == spawnButton then local row, col = guiGridListGetSelectedItem ( spawnList ) if row == -1 then outputChatBox ( "*You have to select a location to spawn first!", 255, 0, 0 ) else if row == location1 then spawnX = 1130.0665 + math.random ( 1, 3 ) spawnY = -1488.45678 spawnZ = 22.76903 rot = 0 elseif row == location2 then spawnX = -1757.7215 + math.random ( 1, 3 ) spawnY = 957.9381 spawnZ = 24.8828 rot = 180 elseif row == location2b then spawnX = 2223.3437 spawnY = -1160.2365 spawnZ = 26 rot = 0 elseif row == location2c then spawnX = 2512.5363 spawnY = -1673.1607 spawnZ = 13.4983 rot = 74 elseif row == doherty then spawnX = -2023.8781 spawnY = 156.6600 spawnZ = 29 rot = 270 elseif row == batteryPoint then spawnX = -2631.9372 spawnY = 1381.6345 spawnZ = 7.1704 rot = 180 elseif row == location3 then spawnX = 2028.0147 spawnY = 1916.1400 + math.random ( 1, 3 ) spawnZ = 12.3284 rot = 260 elseif row == lastResort then spawnX = 2368.5908 spawnY = 1660.3601 spawnZ = 11 rot = 270 elseif row == highRoller then spawnX = 1955.9962 spawnY = 1342.9613 spawnZ = 16 rot = 270 end skin = math.random ( 0, 288 ) interior = 0 dimension = 0 team = user_Team triggerServerEvent ( "spawnWindow_SpawnPlayer", getLocalPlayer(), spawnX, spawnY, spawnZ, rot, skin, interior, dimension, team ) end elseif source == spawnList then local row, col = guiGridListGetSelectedItem ( spawnList ) if row == -1 then --no row was selected else if row == location1 then setCameraMatrix ( 1170.7250, -1481.7625, 30.4994, 1131.1616, -1495.6624, 22.7690 ) elseif row == location2 then setCameraMatrix ( -1736.7707, 959.3780, 24.8828, -1838.4617, 906.7504, 49.3268 ) elseif row == location2b then setCameraMatrix ( 2193.6376, -1108.1195, 24.8521, 2205.5949, -1138.3500, 34.2421 ) elseif row == location2c then setCameraMatrix ( 2442.3122, -1655.8826, 27.9151, 2510.4106, -1676.0703, 13.5468 ) elseif row == location3 then setCameraMatrix ( 2132.0070, 1945.4909, 10.6828, 1979.1539, 1916.1916, 95.1458 ) elseif row == doherty then setCameraMatrix ( -2015.3387, 184.3074, 27.6875, -2034.9644, 166.5152, 30.9673 ) elseif row == batteryPoint then setCameraMatrix ( -2580.9016, 1359.5323, 15.3211, -2614.8896, 1381.2315, 12.5663 ) elseif row == lastResort then setCameraMatrix ( 2397.0244, 1663.3498, 16.6667, 2367.6035, 1652.3618, 10.8203 ) elseif row == highRoller then setCameraMatrix ( 2036.9645, 1343.3657, 10.8203, 2010.3544, 1343.3742, 11.9886 ) end end end end end The idea behind all these arguments for setCameraMatrix is not only for aesthetic purposes but I also try to make the code load the area where the player wants to spawn into memory so it won't take as long, or they have less chance of falling through an LOD map. Here is my current code for server. addEvent ( "spawnWindow_SpawnPlayer", true ) function server_SpawnClient ( x, y, z, rot, skin, interior, dimension, team ) setTimer ( spawnPlayer, 1000, 1, client, x, y, z, rot, skin, interior, dimension, team ) setTimer ( setCameraTarget, 1000, 1, client, client ) fadeCamera ( client, false, 1.0, 0, 0, 0 ) setTimer ( fadeCamera, 2000, 1, client, true, 3.0 ) triggerClientEvent ( client, "playerSpawnedComplete", client ) end addEventHandler ( "spawnWindow_SpawnPlayer", getRootElement(), server_SpawnClient )
  23. Well Thanks but I explained actually where my problem might be. I just don't see whats wrong with it, other then the fact that you explained that I shouldn't compare floats. I have always had this same exact problem with any spawn script I have made. I guess I will change my float comparison thing and get back.
  24. I have 2 scripts that handle spawns for players when they join my server. A login GUI and another GUI that lets you select your spawn location. Half the time the actual spawning works and other times not. Often when players select a spawn location and press the spawn button the player is either spawned "falling" under the middle of the map or they don't spawn at all. Then I get a infinite running script flooding my debug and it causes a tremendous FPS drop for most if not all clients. Probably bogs the server too. If I try to loop the code to make sure it spawns the player it still becomes inaffective at times and does not spawn the player and of course causes an infinite loop which will soon be aborted. If I run a simple check to see if the player is not in the middle of the map then it still dont work. Sometimes players even report black non manipulative screens function server_SpawnClient ( x, y, z, rot, skin, interior, dimension, team ) setTimer ( spawnPlayer, 1000, 1, client, x, y, z, rot, skin, interior, dimension, team ) --spawnPlayer ( client, x, y, z, rot, skin, interior, dimension, team ) setTimer ( setCameraTarget, 1000, 1, client, client ) fadeCamera ( client, false, 1.0, 0, 0, 0 ) setTimer ( fadeCamera, 2000, 1, client, true, 3.0 ) triggerClientEvent ( client, "playerSpawnedComplete", client ) local cX, cY, cZ = getElementPosition ( client ) if cX == 0 and cY == 0 and cZ == 0 then server_SpawnClient() end end EDIT: One other related problem I have is that a specific player in my server says that when he logs in, not only can he not spawn correctly, but his ping sky rockets. There are 2 main ways to spawn in my server upon joining. 1. Login_Gui (If you do not log in or register, there is a button you can click that says "play as guest" which spawns you at the LV airport) 2. Spawn GUI. This is the script that handles the spawns for any player who either logs in or registers. This is where I think the most of the problem may be coming from, however I call events from the login_gui script and the events get answered in this script.
  25. Thanks 50P I went ahead and made a request.
×
×
  • Create New...