Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. @Jaysds1, Same. EDIT:No, mine returns true if I include mta_sdk only, if I include second one, it returns nil. Perhaps it's your webhost, I had such problem before.
  2. Jaysds, read my last post... I said I tried, another one which didn't have errors.
  3. JR10

    Moving vehicle

    There is no easy way to do that, you will need to make a script for that.
  4. I don't think that's the problem, I tried another php script, it doesn't have any errors, and still it didn't work.
  5. Sorry for double posting. I tried changing the included file, and it worked. So the problem is in the included file. Here it is: <?php # MantisConnect - A webservice interface to Mantis Bug Tracker # Copyright (C) 2004-2011 Victor Boctor - [email protected] # This program is distributed under dual licensing. These include # GPL and a commercial licenses. Victor Boctor reserves the right to # change the license of future releases. # See docs/ folder for more details # set up error_handler() as the new default error handling function set_error_handler( 'mc_error_handler' ); # override some MantisBT configurations $g_show_detailed_errors = OFF; $g_stop_on_errors = ON; $g_display_errors = array( E_WARNING => 'halt', E_NOTICE => 'halt', E_USER_ERROR => 'halt', E_USER_WARNING => 'halt', E_USER_NOTICE => 'halt', ); /** * Get the MantisConnect webservice version. */ function mc_version() { return MANTIS_VERSION; } # Checks if MantisBT installation is marked as offline by the administrator. # true: offline, false: online function mci_is_mantis_offline() { $t_offline_file = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'mantis_offline.php'; return file_exists( $t_offline_file ); } # return user_id if successful, otherwise false. function mci_check_login( $p_username, $p_password ) { if( mci_is_mantis_offline() ) { return false; } # if no user name supplied, then attempt to login as anonymous user. if( is_blank( $p_username ) ) { $t_anon_allowed = config_get( 'allow_anonymous_login' ); if( OFF == $t_anon_allowed ) { return false; } $p_username = config_get( 'anonymous_account' ); # do not use password validation. $p_password = null; } if( false === auth_attempt_script_login( $p_username, $p_password ) ) { return false; } return auth_get_current_user_id(); } function mci_has_readonly_access( $p_user_id, $p_project_id = ALL_PROJECTS ) { $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); return( $t_access_level >= config_get( 'mc_readonly_access_level_threshold' ) ); } function mci_has_readwrite_access( $p_user_id, $p_project_id = ALL_PROJECTS ) { $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); return( $t_access_level >= config_get( 'mc_readwrite_access_level_threshold' ) ); } function mci_has_access( $p_access_level, $p_user_id, $p_project_id = ALL_PROJECTS ) { $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); return( $t_access_level >= (int) $p_access_level ); } function mci_has_administrator_access( $p_user_id, $p_project_id = ALL_PROJECTS ) { $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); return( $t_access_level >= config_get( 'mc_admin_access_level_threshold' ) ); } function mci_get_project_id( $p_project ) { if( (int) $p_project['id'] != 0 ) { $t_project_id = (int) $p_project['id']; } else { $t_project_id = project_get_id_by_name( $p_project['name'] ); } return $t_project_id; } function mci_get_project_status_id( $p_status ) { return mci_get_enum_id_from_objectref( 'project_status', $p_status ); } function mci_get_project_view_state_id( $p_view_state ) { return mci_get_enum_id_from_objectref( 'project_view_state', $p_view_state ); } function mci_get_user_id( $p_user ) { $t_user_id = 0; if ( isset( $p_user['id'] ) && (int) $p_user['id'] != 0 ) { $t_user_id = (int) $p_user['id']; } elseif ( isset( $p_user['name'] ) ) { $t_user_id = user_get_id_by_name( $p_user['name'] ); } return $t_user_id; } function mci_get_user_lang( $p_user_id ) { $t_lang = user_pref_get_pref( $p_user_id, 'language' ); if( $t_lang == 'auto' ) { $t_lang = config_get( 'fallback_language' ); } return $t_lang; } function mci_get_status_id( $p_status ) { return mci_get_enum_id_from_objectref( 'status', $p_status ); } function mci_get_severity_id( $p_severity ) { return mci_get_enum_id_from_objectref( 'severity', $p_severity ); } function mci_get_priority_id( $p_priority ) { return mci_get_enum_id_from_objectref( 'priority', $p_priority ); } function mci_get_reproducibility_id( $p_reproducibility ) { return mci_get_enum_id_from_objectref( 'reproducibility', $p_reproducibility ); } function mci_get_resolution_id( $p_resolution ) { return mci_get_enum_id_from_objectref( 'resolution', $p_resolution ); } function mci_get_projection_id( $p_projection ) { return mci_get_enum_id_from_objectref( 'projection', $p_projection ); } function mci_get_eta_id( $p_eta ) { return mci_get_enum_id_from_objectref( 'eta', $p_eta ); } function mci_get_view_state_id( $p_view_state ) { return mci_get_enum_id_from_objectref( 'view_state', $p_view_state ); } # Get null on empty value. # # @param Object $p_value The value # @return Object The value if not empty; null otherwise. # function mci_null_if_empty( $p_value ) { if( !is_blank( $p_value ) ) { return $p_value; } return null; } /** * Gets the url for MantisBT. * * @return MantisBT URL terminated by a /. */ function mci_get_mantis_path() { return config_get( 'path' ); } # Given a enum string and num, return the appropriate localized string function mci_get_enum_element( $p_enum_name, $p_val, $p_lang ) { $t_enum_string = config_get( $p_enum_name . '_enum_string' ); $t_localized_enum_string = lang_get( $p_enum_name . '_enum_string', $p_lang ); return MantisEnum::getLocalizedLabel( $t_enum_string, $t_localized_enum_string, $p_val ); } # Gets the sub-projects that are accessible to the specified user / project. function mci_user_get_accessible_subprojects( $p_user_id, $p_parent_project_id, $p_lang = null ) { if( $p_lang === null ) { $t_lang = mci_get_user_lang( $p_user_id ); } else { $t_lang = $p_lang; } $t_result = array(); foreach( user_get_accessible_subprojects( $p_user_id, $p_parent_project_id ) as $t_subproject_id ) { $t_subproject_row = project_cache_row( $t_subproject_id ); $t_subproject = array(); $t_subproject['id'] = $t_subproject_id; $t_subproject['name'] = $t_subproject_row['name']; $t_subproject['status'] = mci_enum_get_array_by_id( $t_subproject_row['status'], 'project_status', $t_lang ); $t_subproject['enabled'] = $t_subproject_row['enabled']; $t_subproject['view_state'] = mci_enum_get_array_by_id( $t_subproject_row['view_state'], 'project_view_state', $t_lang ); $t_subproject['access_min'] = mci_enum_get_array_by_id( $t_subproject_row['access_min'], 'access_levels', $t_lang ); $t_subproject['file_path'] = array_key_exists( 'file_path', $t_subproject_row ) ? $t_subproject_row['file_path'] : ""; $t_subproject['description'] = array_key_exists( 'description', $t_subproject_row ) ? $t_subproject_row['description'] : ""; $t_subproject['subprojects'] = mci_user_get_accessible_subprojects( $p_user_id, $t_subproject_id, $t_lang ); $t_result[] = $t_subproject; } return $t_result; } function translate_category_name_to_id( $p_category_name, $p_project_id ) { if ( !isset( $p_category_name ) ) { return 0; } $t_cat_array = category_get_all_rows( $p_project_id ); foreach( $t_cat_array as $t_category_row ) { if( $t_category_row['name'] == $p_category_name ) { return $t_category_row['id']; } } return 0; } /** * Basically this is a copy of core/filter_api.php#filter_db_get_available_queries(). * The only difference is that the result of this function is not an array of filter * names but an array of filter structures. */ function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id = null ) { $t_filters_table = db_get_table( 'mantis_filters_table' ); $t_overall_query_arr = array(); if( null === $p_project_id ) { $t_project_id = helper_get_current_project(); } else { $t_project_id = db_prepare_int( $p_project_id ); } if( null === $p_user_id ) { $t_user_id = auth_get_current_user_id(); } else { $t_user_id = db_prepare_int( $p_user_id ); } # If the user doesn't have access rights to stored queries, just return if( !access_has_project_level( config_get( 'stored_query_use_threshold' ) ) ) { return $t_overall_query_arr; } # Get the list of available queries. By sorting such that public queries are
  6. Yes, didn't work. It's weird, when I use mta::doReturn before including, it works. Doesn't work: <?php include "../mta_sdk/mta_sdk.php" ; include "../file/test.php" ; mta::doReturn ( "true" ); ?> Works: <?php include "../mta_sdk/mta_sdk.php" ; mta::doReturn ( "true" ); include "../file/test.php" ; ?>
  7. It's just supposed to return "true", For some reason it doesn't when I add another include.
  8. I'm facing a weird problem, I included 2 files, the mta_sdk.php and another one, When I use mta::doReturn it doesn't work, and the script returns nil, But if I remove the second include, not mta_sdk.php, it works. I did try something else like executing a function defined in the included php, and it worked, So the problem is not in the included php itself. Doesn't work: <?php include "../mta_sdk/mta_sdk.php" ; include "../file/test.php" ; mta::doReturn ( "true" ); ?> Works: <?php include "../mta_sdk/mta_sdk.php" ; mta::doReturn ( "true" ); ?>
  9. model = {} x = {} y = {} z = {} rx = {} ry = {} rz = {} numberplate = {} upgrades = {} color = {} paintjob = {} owner = {} temp = {} vehicle = {} function loadup(startedRecource) vehicles = xmlLoadFile ( "vehicles.xml" ) count = xmlNodeGetChildren(vehicles) for i=1,#count do local vehicle = xmlFindChild ( vehicles, "vehicle", i-1 ) local attributes = xmlNodeGetAttributes ( vehicle ) for name,value in pairs ( attributes ) do temp["" .. name .. ""] = value end x[i] = temp["posX"] y[i] = temp["posY"] z[i] = temp["posZ"] rx[i] = temp["rotX"] ry[i] = temp["rotY"] rz[i] = temp["rotZ"] numberplate[i] = temp["plate"] upgrades[i] = temp["upgrades"] color[i] = temp["color"] paintjob[i] = temp["paintjob"] owner[i] = temp["id"] model[i] = temp["model"] vehicle = createVehicle ( model[i], x[i], y[i], z[i], rx[i], ry[i], rz[i], numberplate[i]) addVehicleUpgrade ( vehicle, 1010 ) setVehicleColor ( vehicle, 0, 0, 0, 0) end xmlUnloadFile ( vehicles ) end function checkowner (player,seat,jacked) local account = getPlayerAccount( player) local accountName = getAccountName(account) if owner[i] ~= accountName and seat == 0 then outputChatBox ( "You cannot drive this vehicle as it belongs to: "..tostring(owner[i]), player, 200, 0, 0 ) cancelEvent() end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), loadup ) addEventHandler ( "onVehicleStartEnter", getRootElement(), checkowner)
  10. model = {} x = {} y = {} z = {} rx = {} ry = {} rz = {} numberplate = {} upgrades = {} color = {} paintjob = {} owner = {} temp = {} vehicle = {} function loadup(startedRecource) vehicles = xmlLoadFile ( "vehicles.xml" ) count = xmlNodeGetChildren(vehicles) for i=1,#count do local vehicle = xmlFindChild ( vehicles, "vehicle", i-1 ) local attributes = xmlNodeGetAttributes ( vehicle ) for name,value in pairs ( attributes ) do temp["" .. name .. ""] = value end x[i] = temp["posX"] y[i] = temp["posY"] z[i] = temp["posZ"] rx[i] = temp["rotX"] ry[i] = temp["rotY"] rz[i] = temp["rotZ"] numberplate[i] = temp["plate"] upgrades[i] = temp["upgrades"] color[i] = temp["color"] paintjob[i] = temp["paintjob"] owner[i] = temp["id"] model[i] = temp["model"] vehicle = createVehicle ( model[i], x[i], y[i], z[i], rx[i], ry[i], rz[i], numberplate[i]) addVehicleUpgrade ( vehicle, 1010 ) setVehicleColor ( vehicle, 0, 0, 0, 0) end xmlUnloadFile ( vehicles ) end function checkowner (player,seat,jacked) local account = getPlayerAccount( player) local accountName = getAccountName(account) if owner[i] == accountName and seat == 0 then outputChatBox ( "You cannot drive this vehicle as it belongs to: "..tostring(owner), player, 200, 0, 0 ) cancelEvent() end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), loadup ) addEventHandler ( "onVehicleStartEnter", getRootElement(), checkowner)
  11. Make it able to download the current version, whatever it is.
  12. JR10

    Sounds.

    Well, you had that error right?
  13. JR10

    Sounds.

    You're welcome.
  14. JR10

    Sounds.

    That's because, in your meta it's "sounds/misc/heart_beat.wav", while in the script "misc/heart_beat.wav".
  15. JR10

    Sounds.

    And the meta.xml.
  16. You messed it, problem is I can't post whole script, it's too large. Add me on skype:JR10.cx10
  17. YES, are you afraid to test it?
  18. JR10

    Sounds.

    Since it's simple, why are you afraid to post it?
  19. Not correct, should be: else elseif column.name == "Country" then if content ~= "N/A" then dxDrawImage( topX+theX+s(1), y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI) end And the script: exports.scoreboard:addScoreboardColumn("Country",root,2,150.0 ) addEventHandler ( "onPlayerJoin" , root , function ( ) local flag = exports.admin:getPlayerCountry ( source ) if flag and fileExists ( ":admin/client/images/flags/"..flag..".png") then setElementData(source,"Country",":admin/client/images/flags/"..flag..".png") else setElementData ( source , "Country" , "N/A") end end) countryNames = { ['AD'] = 'Andorra', ['AE'] = 'United Arab Emirates', ['AF'] = 'Afghanistan', ['AG'] = 'Antigua and Barbuda', ['AI'] = 'Anguilla', ['AL'] = 'Albania', ['AM'] = 'Armenia', ['AO'] = 'Angola', ['AP'] = 'ARIPO', ['AR'] = 'Argentina', ['AT'] = 'Austria', ['AU'] = 'Australia', ['AW'] = 'Aruba', ['AZ'] = 'Azerbaijan', ['BA'] = 'Bosnia and Herzegovina', ['BB'] = 'Barbados', ['BD'] = 'Bangladesh', ['BE'] = 'Belgium', ['BF'] = 'Burkina Faso', ['BG'] = 'Bulgaria', ['BH'] = 'Bahrain', ['BI'] = 'Burundi', ['BJ'] = 'Benin', ['BM'] = 'Bermuda', ['BN'] = 'Brunei Darussalam', ['BO'] = 'Bolivia', ['BQ'] = 'Bonaire', ['BR'] = 'Brazil', ['BS'] = 'Bahamas', ['BT'] = 'Bhutan', ['BV'] = 'Bouvet Island', ['BW'] = 'Botswana', ['BY'] = 'Belarus', ['BZ'] = 'Belize', ['CA'] = 'Canada', ['CD'] = 'Congo', ['CF'] = 'Central African Republic', ['CG'] = 'Congo', ['CH'] = 'Switzerland', ['CI'] = 'Cote d?Ivoire', ['CK'] = 'Cook Islands', ['CL'] = 'Chile', ['CM'] = 'Cameroon', ['CN'] = 'China', ['CO'] = 'Colombia', ['CR'] = 'Costa Rica', ['CU'] = 'Cuba', ['CV'] = 'Cape Verde', ['CW'] = 'Curacao', ['CY'] = 'Cyprus', ['CZ'] = 'Czech Republic', ['DE'] = 'Germany', ['DJ'] = 'Djibouti', ['DK'] = 'Denmark', ['DM'] = 'Dominica', ['DO'] = 'Dominican Republic', ['DZ'] = 'Algeria', ['EC'] = 'Ecuador', ['EE'] = 'Estonia', ['EG'] = 'Egypt', ['EH'] = 'Western Sahara', ['ER'] = 'Eritrea', ['ES'] = 'Spain', ['ET'] = 'Ethiopia', ['FI'] = 'Finland', ['FJ'] = 'Fiji', ['FK'] = 'Malvinas', ['FO'] = 'Faroe Islands', ['FR'] = 'France', ['GA'] = 'Gabon', ['GB'] = 'United Kingdom', ['GD'] = 'Grenada', ['GE'] = 'Georgia', ['GG'] = 'Guernsey', ['GH'] = 'Ghana', ['GI'] = 'Gibraltar', ['GL'] = 'Greenland', ['GM'] = 'Gambia', ['GN'] = 'Guinea', ['GQ'] = 'Equatorial Guinea', ['GR'] = 'Greece', ['GT'] = 'Guatemala', ['GW'] = 'Guinea-Bissau', ['GY'] = 'Guyana', ['HN'] = 'Honduras', ['HR'] = 'Croatia', ['HT'] = 'Haiti', ['HU'] = 'Hungary', ['ID'] = 'Indonesia', ['IE'] = 'Ireland', ['IL'] = 'Israel', ['IM'] = 'Isle of Man', ['IN'] = 'India', ['IQ'] = 'Iraq', ['IR'] = 'Iran', ['IS'] = 'Iceland', ['IT'] = 'Italy', ['JE'] = 'Jersey', ['JM'] = 'Jamaica', ['JO'] = 'Jordan', ['JP'] = 'Japan', ['KE'] = 'Kenya', ['KG'] = 'Kyrgyzstan', ['KH'] = 'Cambodia', ['KI'] = 'Kiribati', ['KM'] = 'Comoros', ['KN'] = 'Saint Kitts and Nevis', ['KP'] = 'Korea', ['KR'] = 'Korea', ['KW'] = 'Kuwait', ['KY'] = 'Cayman Islands', ['KZ'] = 'Kazakhstan', ['LA'] = 'Lao People?s Republic', ['LB'] = 'Lebanon', ['LC'] = 'Saint Lucia', ['LI'] = 'Liechtenstein', ['LK'] = 'Sri Lanka', ['LR'] = 'Liberia', ['LS'] = 'Lesotho', ['LT'] = 'Lithuania', ['LU'] = 'Luxembourg', ['LV'] = 'Latvia', ['LY'] = 'Libyan Arab Jamahiriya', ['MA'] = 'Morocco', ['MC'] = 'Monaco', ['MD'] = 'Moldova', ['ME'] = 'Montenegro', ['MG'] = 'Madagascar', ['MK'] = 'Macedonia', ['ML'] = 'Mali', ['MM'] = 'Myanmar', ['MN'] = 'Mongolia', ['MO'] = 'Macao', ['MP'] = 'Northern Mariana Islands', ['MR'] = 'Mauritania', ['MS'] = 'Montserrat', ['MT'] = 'Malta', ['MU'] = 'Mauritius', ['MV'] = 'Maldives', ['MW'] = 'Malawi', ['MX'] = 'Mexico', ['MY'] = 'Malaysia', ['MZ'] = 'Mozambique', ['NA'] = 'Namibia', ['NE'] = 'Niger', ['NG'] = 'Nigeria', ['NI'] = 'Nicaragua', ['NL'] = 'Netherlands', ['NO'] = 'Norway', ['NP'] = 'Nepal', ['NR'] = 'Nauru', ['NZ'] = 'New Zealand', ['OM'] = 'Oman', ['PA'] = 'Panama', ['PE'] = 'Peru', ['PG'] = 'Papua New Guinea', ['PH'] = 'Philippines', ['PK'] = 'Pakistan', ['PL'] = 'Poland', ['PT'] = 'Portugal', ['PW'] = 'Palau', ['PY'] = 'Paraguay', ['QA'] = 'Qatar', ['RO'] = 'Romania', ['RS'] = 'Serbia', ['RU'] = 'Russian Federation', ['RW'] = 'Rwanda', ['SA'] = 'Saudi Arabia', ['SB'] = 'Solomon Islands', ['SC'] = 'Seychelles', ['SD'] = 'Sudan', ['SE'] = 'Sweden', ['SG'] = 'Singapore', ['SH'] = 'Saint Helena', ['SI'] = 'Slovenia', ['SK'] = 'Slovakia', ['SL'] = 'Sierra Leone', ['SM'] = 'San Marino', ['SN'] = 'Senegal', ['SO'] = 'Somalia', ['SR'] = 'Suriname', ['ST'] = 'Sao Tome and Principe', ['SV'] = 'Salvador', ['SX'] = 'Sint Maarten (Dutch part)', ['SY'] = 'Syrian Arab Republic', ['SZ'] = 'Swaziland', ['TC'] = 'Turks and Caicos Islands', ['TD'] = 'Chad', ['TG'] = 'Togo', ['TH'] = 'Thailand', ['TJ'] = 'Tajikistan', ['TL'] = 'Timor?Leste', ['TM'] = 'Turkmenistan', ['TN'] = 'Tunisia', ['TO'] = 'Tonga', ['TR'] = 'Turkey', ['TT'] = 'Trinidad and Tobago', ['TV'] = 'Tuvalu', ['TW'] = 'Taiwan', ['TZ'] = 'Tanzania', ['UA'] = 'Ukraine', ['UG'] = 'Uganda', ['US'] = 'United States of America', ['UY'] = 'Uruguay', ['UZ'] = 'Uzbekistan', ['VA'] = 'Holy See', ['VC'] = 'Saint Vincent', ['VE'] = 'Venezuela', ['VG'] = 'Virgin Islands', ['VN'] = 'Viet Nam', ['VU'] = 'Vanuatu', ['WS'] = 'Samoa', ['YE'] = 'Yemen', ['ZA'] = 'South Africa', ['ZZ'] = 'n/a', ['ZM'] = 'Zambia', ['ZW'] = 'Zimbabwe' } addEventHandler("onPlayerJoin", root, function() local country = exports["admin"]:getPlayerCountry(source) if country then setElementData(source,"Country",countryNames[country]) outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#00FF09 has joined the server From #FF8900[' .. tostring(countryNames[countryCode]) .. '] ', getRootElement(), 2, 255, 2, true) else setElementData(source,"Country","N/A") outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#00FF09 has joined the server',getRootElement(),255,255,255,true) end end) addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#03B4FF is now known as #ffffff' .. newNick, getRootElement(), 3, 180, 255, true) end) addEventHandler('onPlayerQuit', root, function(reason)
  20. JR10

    Sounds.

    And post the script.
  21. If I get what you're saying right, you're using a variable returned by playSound with playSound, which won't work. playSound needs a string containing the path to the sound that will be played. So instead of currentSound, use random.
  22. It should work for 1.3, works for me.
×
×
  • Create New...