Jump to content

GRascm

Members
  • Posts

    23
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

GRascm's Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. Небольшая просьба к тем кто хорошо знает английский язык: Исправьте пожалуйста мои ошибки: https://wiki.multitheftauto.com/wiki/Set ... onProgress PS в русской версии вроде бы должно быть всё правильно.
  2. I not very good in english, that's why i have documented it in english and russian both.
  3. Fixed, i hope. I have done everething and have sent a patch to mantis.
  4. Yeah! Thank you for the tips, I made it! =) Not really great code, but it works. Here is the short demonstration of SetPedAnimationProgress function: And simple script, that i used to test animation progress: Progress = 0.5 function addAnim() setPedAnimation( getLocalPlayer(), "SMOKING", "M_SMKSTND_LOOP") end addEventHandler( "onClientPlayerSpawn", getLocalPlayer(), addAnim) function changeProgress(commandName, newProgress) Progress = newProgress / 100; end addCommandHandler("animprogress", changeProgress) function animRender() setPedAnimationProgress(getLocalPlayer(), "M_SMKSTND_LOOP", Progress) end addEventHandler("onClientRender", getRootElement(), animRender) And of cource a patch to MTA. http://pastebin.com/aC7tLWK3 I have implemented just a client setPedAnimationFunction, I hope someone will implement animation syncing, and i have a stupid question: /* Here must be something like float fNewTime = pA->GetInterface()->pAnimHierarchy->fTotalTime * fProgress; But only abstract classes avaliable here */ float fNewTime = *(float *)(*(DWORD *)( ((DWORD)(pA->GetInterface())) + 20) + 16) * fProgress; What to do with this?
  5. A year ago i posted a request for setPedAnimationProgress scripting function And there was no progress, it still has "new" status. I tried to implement it myself, but nothing work And i am asking for help now. This is original GTA opcode handler for 0x0614(0614: set_actor $PLAYER_ACTOR animation "GYM_BP_DOWN" progress_to $1822 // 0.0 to 1.0) opcode. With my(and not only my comments). .text:00491802 ; __linkproc__ opcode_0614 .text:00491802 @@opcode_0614: ; CODE XREF: _opcode_handler_15+37j .text:00491802 ; DATA XREF: .text:__linkproc__ opcode_tableo .text:00491802 234 push 1 ; set_actor %1d% animation %2h% progress_to %3d% // 0.0 to 1.0 .text:00491804 238 mov ecx, esi .text:00491806 238 call CScriptThread__getNumberParams .text:0049180B 234 mov ecx, _opcodeParameters .text:00491811 234 push ecx ; int .text:00491812 238 mov ecx, _PedPool .text:00491818 238 call ?atHandle@?$CPool@VCPed@@@@QAEPAVCVehicle@@I@Z ; CPed * CPool<CPed>::atHandle (u32 h); .text:0049181D 234 push 18h .text:0049181F 238 lea edx, [esp+238h+var_1E4] .text:00491823 238 push edx .text:00491824 23C mov ecx, esi .text:00491826 23C mov edi, eax .text:00491828 23C call _CScriptThread__getStringParam .text:0049182D 234 mov ecx, [edi+18h] .text:00491830 234 lea eax, [esp+234h+var_1E4] .text:00491834 234 push eax .text:00491835 238 push ecx ; This function is actually FUNC_RpAnimBlendClumpGetAssociation_str, stores pointer to CAnimBlendAssociationSAInterface in EAX .text:00491836 23C call sub_4D6870 .text:0049183B 23C add esp, 8 .text:0049183E 234 push 1 ; count .text:00491840 238 mov ecx, esi ;moving our pointer to EDI .text:00491842 238 mov edi, eax .text:00491844 238 call CScriptThread__getNumberParams ; if pointer is zero jump to return else continue running .text:00491849 234 test edi, edi .text:0049184B 234 jz loc_492203 ;Moving CAnimBlendHierarchySAInterface pointer from CAnimBlendAssociationSAInterface in EDX .text:00491851 234 mov edx, [edi+14h] ;It seems like loading fTotalTime field into FPU .text:00491854 234 fld dword ptr [edx+10h] ;I cant understand what this code do, but it is floating point multiplication i think (using the stack? o_O) .text:00491857 234 push ecx .text:00491858 238 fmul _opcodeParameters ;store in ecx pointer to CAnimBlendAssociationSAInterface .text:0049185E 238 mov ecx, edi .text:00491860 238 fstp [esp+238h+var_238] ;calling function that actually sets animation frame position, takes one float argument, also uses data from ECX(there stored our pointer to that time) .text:00491863 238 call sub_4CEA80 ; set animation progress .text:00491868 234 xor al, al .text:0049186A 234 jmp loc_492AAB the function beginng .text:004CEA80 arg_0 = dword ptr 4 ;taking the argument of the function .text:004CEA80 000 mov eax, [esp+arg_0] .text:004CEA84 000 fld [esp+arg_0] ;saving values, i think .text:004CEA88 000 push ebx .text:004CEA89 004 push esi moving our pointer to esi and working with it .text:004CEA8A 008 mov esi, ecx .text:004CEA8C 008 mov ecx, [esi+14h] .text:004CEA8F 008 mov [esi+20h], eax ;... continue I tried to add it to the MTA bool CStaticFunctionDefinitions::SetPedAnimationProgress ( CClientEntity& Entity, const char * szAnimName, float fProgress ) { RUN_CHILDREN SetPedAnimationProgress ( **iter, szAnimName, fProgress ); if ( IS_PED ( &Entity ) ) { CClientPed& Ped = static_cast < CClientPed& > ( Entity ); CAnimBlendAssociation* pA = g_pGame->GetAnimManager ()->RpAnimBlendClumpGetAssociation ( Ped.GetClump (), szAnimName ); if ( pA ) { pA->SetCurrentTime ( fProgress ); } } return false; } and void CAnimBlendAssociationSA::SetCurrentTime ( float fTime ) { DWORD DwFunc = 0x4CEA80; // function that actually sets the progress float* fPointer = &fTime; //pointer to fTime, to pass it to function _asm { push ecx ; saving old ECX value mov ecx, m_pInterface ; moving "that" pointer to ECX, like the opcode handler push fPointer ; push the function argument call DwFunc ; call the function pop ecx ; and restore the ECX }; } But of course nothing works, and game crashes. May be anyone have any idea? What am i doing wrong?
  6. The same problem as i describe on Win7 64bit (same computer) appears not always, i even could connect and play =) But it still appears, win7 64bit dump: http://sendfile.su/397054
  7. I has connected to server, "Main" chatline was displayed ("Connected to MTA 1.1 Test Server [Windows]") Then may be 1-2 chat messages, and BOOM "Error! Can't send WM_COPYDATA". Or just full hanging. (Hanging(Полное зависание) are more often than crash) Dump is here: http://sendfile.su/397044 WinXP 32bit, NVIDIA GeForce 480GTX if it will help. Oh, almost forget, if i clean "resource-cache folder" everything will be normal while resources being downloaded. After finishing download - immediately BUG.
  8. http://sendfile.su/397021 I can't even spawn, get "Can't send WM_COPYDATA" Error Also many times i connect MTA hung all my computer, and i cant even kill it throught task manager
  9. It is so great script editor, and all bugs not so annoing except one - the encoding bug is so annoing, I MUST use 2 editors at a time, MTASE to scripting, and then Notepad++ to re-encode script in necessary encoding. May be you will find a little time, to fix "encoding bug"? A little patch please ALso XML files with functions must update to current MTA version. PS place "function" between "\b" as other keywords, to prevent it from replacing in callClientFunction. <Block Name="Lua Code" Style="Lua Code" EscapeChar="" IsMultiline="true"> <Scope Start="\bfunction\b" End="\bend\b" Style="Lua Keyword" Text="function ... end" CauseIndent="true" EndIsComplex="true" />
  10. GRascm

    Gang zones

    Yes, I asked about the idea of scripting, even though I consider myself a good scripters, I sometimes need help, and there is nothing strange. You get by a negative attitude to the newcomers, if I ask you help, it does not mean that I ask to do everything for me (although some people do so), I just asked the ideas ... no matter on what basis would the seizure occurred, the main idea, and then I figured out ... Actually if anyone is interested I have done everything myself, without any help, realized it this way: When onPlayerWasted event is triggered I check whether the gang member in his area and was, he killed a player opposing gangs located in that area, and if so then start the timer- setTimer(checkCaptureTime, 1000, 1, 0, areaID, playerInfo[killer]["gang"], playerInfo[source]["gang"], currentArea) Here is code of the function: function checkCaptureTime(num, areaID, attackGang, defendGang, area) stillCapturing = false local allPlayers = getElementsByType("player") for k, player in ipairs(allPlayers) do --here we check if player from attacking gang is on current zone, then attack still in progress and stillCapturing = true end if stillCapturing then if num < 300 then --if num < 300 then the battle lasted less than 5 minutes, continue with check timer setTimer(checkCaptureTime, 1000, 1, num+1, areaID, attackGang, defendGang, area) else -- This means that the gang had no time to beat off for 5 minutes, and the territory was conquered by an enemy gang outputChatBox("Gang ID "..defendGang.." loosed it's zone, now it zone of Gang ID "..attackGang ) setRadarAreaColor(area, 0, 255, 0, 100)--actually we ned to redraw to the new band color here... setRadarAreaFlashing(area, false) zoneInfo[areaID]["gangID"] = attackGang end else outputChatBox("Gang ID "..defendGang.." defended it's zone")--It mean that all enemies was killed, and zone was defended end end
  11. GRascm

    Gang zones

    Maybe I'm wrong words, or not correctly translated, but I tried to ask only idea how to do it, I'm pretty good scripters to do everything myself, I just could not think of the principle of implementation.
  12. GRascm

    Gang zones

    Hi everyone, i need a little help with scripting. I am writing an Roleplay server, and i want to add some DM elements such as gang wars for territory under control, gangs will get some % from business on their territory, but it is not main. Main is: i have no idea how to do it, Can you help me? just a simple code, even not working code. There are many little gang zones(more than one hundred) and 4 bands.
  13. I was found another bugs, there is some troubles with player skins I have attached screenshot, can you explain why this is occured? Also sometimes i cant see textures of skins they are white.
  14. To fix bug of replacement callClientFunction to callClientfunction i have edited lua.syn where was such lines <Block Name="Lua Code" Style="Lua Code" EscapeChar="" IsMultiline="true"> <Scope Start="function " End="\bend\b" Style="Lua Keyword" Text="function ... end" CauseIndent="true" EndIsComplex="true" /> I just add spase in Start="function " callClientFunction(...) - there a "(", and function funcName - there a " ".
  15. Thank you for the detailed explanation.
×
×
  • Create New...