Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Client side: addEvent( "hitTheMarker", true ) buyGun_Window = { } weaponList_Grid = { } weaponAccept_Button = { } weaponCancel_Button = { } function gunWindow( ) buyGun_Window[1] = guiCreateWindow( 374,104,346,519,"Select Your Weapon",false ) guiWindowSetSizable( buyGun_Window[1],false ) weaponList_Grid[1] = guiCreateGridList( 11,31,324,435,false,buyGun_Window[1] ) guiGridListSetSelectionMode( weaponList_Grid[1],2 ) local weapon = guiGridListAddColumn( playerList, "Weapon name", 0.85 ) local id = guiGridListAddColumn( playerList, "ID", 0.85 ) local file = xmlLoadFile ( "weapons.xml" ) local info = xmlFindChild ( file, "weapon", 0 ) if info then for i,v in pairs( xmlNodeGetAttributes ( info ) ) do local row = guiGridListAddRow ( weaponList_Grid[1] ) guiGridListSetItemText( weaponList_Grid[1],row,weapon,i,false,false ) guiGridListSetItemText( weaponList_Grid[1],row,id,v,false,false ) end end xmlUnloadFile ( file ) weaponAccept_Button[1] = guiCreateButton( 12,477,118,33,"Accept",false,buyGun_Window[1] ) weaponCancel_Button[2] = guiCreateButton( 213,477,118,31,"Cancel",false,buyGun_Window[1] ) end addEventHandler( "hitTheMarker", root, gunWindow ) Server side: local bankWeaponMarker = createMarker(2304.19921875, -16.19921875, 25.5, "cylinder", 1.5, 0, 0, 255, 255) function installEverything( hElement ) if getElementType( hElement ) == "player" then triggerClientEvent ( hElement,"hitTheMarker" ,hElement ) end end addEventHandler( "onMarkerHit", bankWeaponMarker, installEverything ) weapons.xml <root> <weapon id="1" name="Brass knuckles" /> <weapon id="5" name="Baseball bat" /> <weapon id="15" name="Cane" /> <weapon id="9" name="Chainsaw" /> <weapon id="2" name="Golf club" /> <weapon id="7" name="Pool cue" /> <weapon id="8" name="Katana" /> <weapon id="4" name="Knife" /> <weapon id="3" name="Nightstick" /> <weapon id="6" name="Shovel" /> <weapon id="24" name="Desert eagle" /> <weapon id="22" name="Pistol" /> <weapon id="23" name="Silenced" /> <weapon id="26" name="Sawn-off shotgun" /> <weapon id="25" name="Shotgun" /> <weapon id="27" name="SPAZ-12" /> <weapon id="29" name="MP5" /> <weapon id="32" name="TEC-9" /> <weapon id="28" name="Uzi" /> <weapon id="30" name="AK47" /> <weapon id="31" name="M4" /> <weapon id="33" name="Country sniper" /> <weapon id="34" name="Sniper" /> <weapon id="37" name="Flame thrower" /> <weapon id="36" name="Heat seeking RPG" /> <weapon id="38" name="Minigun" /> <weapon id="35" name="Rocket launcher" /> <weapon id="16" name="Grenade" /> <weapon id="18" name="Molotov" /> <weapon id="39" name="Satchel" /> <weapon id="40" name="Satchel detonator" /> <weapon id="17" name="Tear gas" /> <weapon id="43" name="Camera" /> <weapon id="42" name="Fire extinguisher" /> <weapon id="45" name="Infrared goggles" /> <weapon id="44" name="Night vision goggles" /> <weapon id="46" name="Parachute" /> <weapon id="14" name="Flowers" /> <weapon id="10" name="Long dildo" /> <weapon id="11" name="Short dildo" /> <weapon id="12" name="Vibrator" /> </root> Updated again.
  2. Maybe you need this? https://wiki.multitheftauto.com/wiki/OnPlayerContact
  3. 1.Твой код не верный: thePlayer = nil Тебе нужно юзать переменную source( источник события т.е игрок в данном случае ) 2.Лучше через element data function FSHUD( ) setPedFightingStyle ( source, 6 ) local FSstatus = getPedFightingStyle ( source ) setElementData( source,"style",FSstatus ) end addEventHandler ( "onPlayerJoin",root, FSHUD ) function FSvisible ( ) local sWidth,sHeight = guiGetScreenSize( ) local weaponID = getPedWeapon ( localPlayer ) local weaponSlot = getSlotFromWeapon ( weaponID ) if ( weaponSlot == 0 ) then dxDrawText( tostring ( getElementData( localPlayer,"style" ) ), (213.0/800)*sWidth, (509.0/600)*sHeight, (284.0/800)*sWidth, (528.0/600)*sHeight,tocolor(0,0,0,255), (1.0/800)*sWidth,"arial","right","center",false,false,false) dxDrawText( tostring ( getElementData( localPlayer,"style" ) ), (213.0/800)*sWidth, (509.0/600)*sHeight, (284.0/800)*sWidth, (528.0/600)*sHeight,tocolor(255,255,255,255), (1.0/800)*sWidth,"arial","right","center",false,false,false) end if ( weaponSlot == 0 ) then dxDrawText( tostring ( getElementData( localPlayer,"style" ) ), (213.0/800)*sWidth, (509.0/600)*sHeight, (284.0/800)*sWidth, (528.0/600)*sHeight,tocolor(0,0,0,255), (1.0/800)*sWidth,"arial","right","center",false,false,false) dxDrawText( tostring ( getElementData( localPlayer,"style" ) ), (213.0/800)*sWidth, (509.0/600)*sHeight, (284.0/800)*sWidth, (528.0/600)*sHeight,tocolor(255,255,255,255), (1.0/800)*sWidth,"arial","right","center",false,false,false) end if ( weaponSlot == 0 ) then dxDrawText( tostring ( getElementData( localPlayer,"style" ) ), (213.0/800)*sWidth, (509.0/600)*sHeight, (284.0/800)*sWidth, (528.0/600)*sHeight,tocolor(0,0,0,255), (1.0/800)*sWidth,"arial","right","center",false,false,false) dxDrawText( tostring ( getElementData( localPlayer,"style" ) ), (213.0/800)*sWidth, (509.0/600)*sHeight, (284.0/800)*sWidth, (528.0/600)*sHeight,tocolor(255,255,255,255), (1.0/800)*sWidth,"arial","right","center",false,false,false) end end addEventHandler ("onClientRender", root, FSvisible ) Обновил код
  4. Kenix

    setElementData

    /reconnect and try again. Show full code.
  5. Kenix

    setElementData

    function rankk( ) local gotexp2 = tonumber( getElementData( source,"exp212" ) or 0 ) if gotexp2 == 1 then -- you can use if some then instand of if ( some ) then outputChatBox( tostring( gotexp2 ) ) -- gotexp2 is number value convert to string --outputChatBox( "*sorry",source,0,255,0,true ) -- why true ? Need use false see in arguments function outputChatBox( "*sorry",source,0,255,0 ) else --outputChatBox("ok",source,0,255,0,false ) -- same outputChatBox( "ok",source,0,255,0 ) setElementData( source,"exp212",1 ) end end addEventHandler( "onPlayerWasted",root,rankk ) function new( ) setElementData( source,"exp212",0 ) local alvw = getElementData( source,"exp212" ) -- variable alvw is number outputChatBox( tostring( alvw ) ) -- convert to string end addEvent( "onMapStarting",true) addEventHandler( "onMapStarting",root,new ) SolidShake14,Your code is wrong ... P.S Tabulate your code in next time. P.S See in /debugscript 3 P.S Code updated.
  6. Update to first my post code. function table.empty( t ) if type( t ) ~= "table" then return false end return not next( t ) end addEventHandler( "onPlayerLogin",root, function( ) local acc = getPlayerAccount( source ) if acc then local weap = getAccountData( acc,'weapons' ) if weap then loadstring( "t = { "..weap.." } ".. "for _,v in pairs( t ) do ".. "giveWeapon( "..source..",v[1],v[2],false ) ".. "end" )( ) end end end ) addEventHandler( "onPlayerQuit",root, function( ) local acc = getPlayerAccount( source ) if acc and not isGuestAccount( acc ) then if not table.empty( tWeap[ source ] ) then local eStr = "" for _,v in pairs( tWeap[ source ] ) do eStr = eStr.."{"..v[1]..","..v[2].."}," end setAccountData( acc,"weapons",eStr:sub( 0,#eStr-1 ) ) end end end ) Updated
  7. Better Server local tWeap = { } local tTimer = { } local function giveWeaponsFromTable( source ) if isElement( source ) then for _,v in pairs( tWeap[ source ] ) do giveWeapon( source,v[1],v[2],false ) end return true end return false end local function getAllWeapons( source,ammo ) if isElement( source ) then local Table = { } for i = 0,12 do local weap = getPedWeapon ( source, i ) if not ammo then table.insert( Table,weap ) else local ammos = getPedTotalAmmo( source,i ) if ammos > 0 then table.insert( Table, { weap, ammos } ) end end end return Table end return false end addEventHandler( "onPlayerWasted",root, function( ) tWeap[ source ] = getAllWeapons( source,true ) end ) addEventHandler( "onPlayerSpawn",root, function( ) tTimer[ source ] = setTimer( giveWeaponsFromTable,300,1,source ) tWeap[ source ] = nil end ) addEventHandler( "onPlayerQuit",root, function( ) tWeap[ source ] = nil tTimer[ source ] = nil end ) Updated.
  8. Проблема решилась. Просто измерения не совпадали. P.S Всётаки есть проверка в спектаторе так видимо и не помогала.
  9. This should work Show full code. And use /debugscript 3.
  10. Ты проверь каждый кусочек кода. Что возвращает каждая переменная и т.д
  11. This? Client If you use element data.But idk why you need use element data instead of setElementInterior. addEvent( "onClientPlayerChangeDimension",true ) addEventHandler( "onClientPlayerChangeDimension",root, function( new,old ) outputChatBox ( getPlayerName( source ).."'s new dimension is "..tostring( new ).." and was " ..tostring( old ).. "!" ) end ) addEventHandler ( "onClientElementDataChange", root, function ( dataName, oldValue ) if getElementType ( source ) == "player" and dataName == "dimension" then triggerEvent( "onClientPlayerChangeDimension",source,getElementData ( source, "dimension" ),oldValue ) end end )
  12. Нет не помогло. Тоже самое.
  13. Спасибо что ответил. Сейчас проверю.
  14. Если использовать setCameraTarget то камера будет жестоко лагать т.е если игрок бежит , то он будет бежать интервалами или зависать часто. И я решил сделать свою камеру на замену setCameraTarget. Цель сделать камеру такую же как бы она была в функции setCameraTarget. И у меня есть вопрос. Как именно вычеслить из 3д координатов горизонтальный-угол и вертикальный-угол . Я так понял что 3д координаты дастаём через событие onClientCursorMove и естественно обновляем камеру в onClientPreRender. Если кто не понял я хочу сделать камеру похожею как в Tactics или Basemode. Помогите пожалуйста.
  15. Kenix

    Custom camera.

    Hmm i tested this , but camera few passes through the object. I see in gamemodes:Basemode,Tactics it created perfect .I very interested.
  16. Kenix

    mta-paradise

    I had a problem too and it helped.
  17. Kenix

    mta-paradise

    You need download updated modules. mysql http://multitheftauto-modules.googlecod ... _mysql.dll sha https://github.com/downloads/mabako/mta ... indows.zip
  18. Kenix

    Custom camera.

    Before that I used function setCameraTarget but camera always lagged. http://bugs.mtasa.com/view.php?id=6666 So i create camera with setCameraMatrix and update in onClientPreRender and camera works perfect not lagged , but i have question .How to make the camera does not pass through the building or something. I know , need check between camera and target element with function processLineOfSight. If can lay out an example. I'm not good in the matrix. Thanks in advance.
  19. Kenix

    local gui = {};

    Convert your code to UTF-8 without BOM
×
×
  • Create New...