Giter Site home page Giter Site logo

ysf's Introduction

YSF 2.2.1

alt tag alt tag

YSF is an SA:MP plugin whose purpose is to pull out maximum possibilities from the server, mainly with memory editing and hooking.

Building

Use Visual Studio to build the project on Windows, or make or make static on Linux. For building the 0.3.DL version, define SAMP_03DL.

Credits

ysf's People

Contributors

adrfranklin avatar f0re3t avatar fairuz-afdhal avatar germanaizek avatar ip-gpu avatar is4code avatar karimcambridge avatar kurta999 avatar mellnik avatar n0bodysec avatar narutoua avatar nexiustailer avatar oscar-broman avatar p3ti avatar southclaws avatar spmn avatar tr1xy avatar uint32 avatar whitetigerswt avatar xegare avatar ziggi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ysf's Issues

RemoveClass and include file

I suggest adding Remove/DestroyClass(classid) as it may be very useful. YSI y_classes have these but i guess i wouldnt hurt to have one more simple function...
And add include file with all functions and callbacks to releases (R14-3 and R15 did not have include, and i even wanted to suggest SetPlayerGravity function but checked source and noticed its already there)
Also suggesting adding examples for SendRPC and SendData and some more complex functions/callbacks in first post at samp forums.

SetVehicleSpawnInfo

"respawntime" parameter doesn't work.

Whatever i write, vehicle disappears immediately when player gets out.
This starts happen after first respawn.

no print message with percentage

Version: R16

The plugin affects strings which are going to be printed.
It's not required to include the include file
This also affects format() and on top of this BlueG's mysql plugin.

` print("%Y %D %M");
print("%h:%i:%s %x");

print("Y D M");
print("h i s x");

print("%Y ");
print("%D ");
print("%M");

print("%h");
print("%i ");
print("%s");
print("%x");

`

Result
Y D M h i s x

RebuildRPCData not working on Linux

It seems that RPC ID is wrong in RebuildRPCData. Result of printing uniqueID value at this line:

[22:08:14] RPC: 11141180
[22:08:14] RPC: 1866924105
[22:08:14] RPC: 1931804765
[22:08:14] RPC: 6160523

On Windows everything is fine.

SetVehicleSpawnInfo

Is this possible to add a function to change existing vehicle's spawn info coordinates and have respawnvehicle spawn the vehicle at new place?

Attached Camera not working well since R18.

Hello,
On my server I have a complex First Person system.
I use AttachDynamicObjectToPlayer and AttachCameraToDynamicObject and it worked 100% of the time.
But then I updated to R18 or R18-2 and the same script doesn't work, the updates to the camera are made 1/16 of the times instead of all the times.
Changes to the camera is triggered for example when crouching.
I have put some printf to diagnose, at first I tought it was a problem with OnPlayerKeyStateChange, but no, it works untill the AttachDynamicObjectToPlayer and the function even returns 1, but the camera is not moved.
Normally AttachDynamicObjectToPlayer is called once, then AttachCameraToDynamicObject just changes the camera position, but I also tried with both all the time and even a SetDynamicObjectPos to the player's position before and nothing works.

I guess it has something to do with how the camera attaches to dynamic objects....
I need help to find how to correct this, maybe there is a new way to do it. I sure hope it wont need a new update or this...
When I revert to R16 it just works as is...

Thank you,
rt-2

(Linux) Crash using the latest source

I'm using Debian 8 with SA-MP 0.3.7, compiled the source myself on the same machine.

[28.01.2018 13:40:18] [debug] #0 native FCNPC_Create () from FCNPC.so
[28.01.2018 13:40:18] [debug] #1 0013d8c4 in public LaeNPCd () at impu/systems/npc.pwn:10
[28.01.2018 13:40:18] [debug] Native backtrace:
[28.01.2018 13:40:18] [debug] #0 f73e7180 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] #1 f73df064 in _ZN11CrashDetect20PrintNativeBacktraceERSoRKN2os7ContextE () from plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] #2 f73dfd64 in _ZN11CrashDetect20PrintNativeBacktraceERKN2os7ContextE () from plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] #3 f73e1cdb in _ZN11CrashDetect7OnCrashERKN2os7ContextE () from plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] #4 f73e64d5 in ?? () from plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] #5 f7742ba0 in __kernel_rt_sigreturn () from linux-gate.so.1
[28.01.2018 13:40:18] [debug] #6 f7742bb9 in __kernel_vsyscall () from linux-gate.so.1
[28.01.2018 13:40:18] [debug] #7 f743e367 in gsignal () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[28.01.2018 13:40:18] [debug] #8 f743fa23 in abort () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[28.01.2018 13:40:18] [debug] #9 f766ca25 in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[28.01.2018 13:40:18] [debug] #10 f766a733 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[28.01.2018 13:40:18] [debug] #11 f766a7ad in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[28.01.2018 13:40:18] [debug] #12 f766aace in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[28.01.2018 13:40:18] [debug] #13 f5bdb920 in _ZNSt10_HashtableIjSt4pairIKj11CPlayerDataESaIS3_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS5_18_Mod_range_hashingENS5_20_Default_ranged_hashENS5_20_Prime_rehash_policyENS5_17_Hashtable_traitsILb0ELb0ELb1EEEE21_M_insert_unique_nodeEjjPNS5_10_Hash_nodeIS3_Lb0EEE () from plugins/YSF.so
[28.01.2018 13:40:18] [debug] #14 f5bdb9d7 in _ZNSt10_HashtableIjSt4pairIKj11CPlayerDataESaIS3_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS5_18_Mod_range_hashingENS5_20_Default_ranged_hashENS5_20_Prime_rehash_policyENS5_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIIRjSI_EEES0_INS5_14_Node_iteratorIS3_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_ () from plugins/YSF.so
[28.01.2018 13:40:18] [debug] #15 f5be2033 in _ZN7CPlugin9AddPlayerEi () from plugins/YSF.so
[28.01.2018 13:40:18] [debug] #16 f5be8e9d in _Z31HOOK_CGameMode__OnPlayerConnectP9CGameModei () from plugins/YSF.so
[28.01.2018 13:40:18] [debug] #17 080d09ff in ?? () from ./samp03svr
[28.01.2018 13:40:18] [debug] #18 080b058c in ?? () from ./samp03svr
[28.01.2018 13:40:18] [debug] #19 f5cb69e1 in _ZN10CFunctions9NewPlayerEPc () from plugins/FCNPC.so
[28.01.2018 13:40:18] [debug] #20 f5cc1761 in _ZN14CPlayerManager9AddPlayerEPc () from plugins/FCNPC.so
[28.01.2018 13:40:18] [debug] #21 f5cc4da6 in _ZN8CNatives12FCNPC_CreateEP6tagAMXPi () from plugins/FCNPC.so
[28.01.2018 13:40:18] [debug] #22 080950e4 in ?? () from ./samp03svr
[28.01.2018 13:40:18] [debug] #23 f73e0ad3 in _ZN11CrashDetect17HandleAMXCallbackEiPiS0_ () from plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] #24 ff8f3078 in ?? () from  ‡p÷H…p÷Ü$°ˇÜ$°ˇŻ,°ˇÜ$°ˇŃ-°ˇæD°ˇ��q÷�
[28.01.2018 13:40:18] [debug] Registers:
[28.01.2018 13:40:18] [debug] EAX: 00000000 EBX: 000076fe ECX: 000076fe EDX: 00000006
[28.01.2018 13:40:18] [debug] ESI: f76d4dc2 EDI: f75b9000 EBP: ff8f2418 ESP: ff8f2294
[28.01.2018 13:40:18] [debug] EIP: f7742bb9 EFLAGS: 00000202
[28.01.2018 13:40:18] [debug] Stack:
[28.01.2018 13:40:18] [debug] ESP+00000000: ff8f2418 00000006 000076fe f743e367
[28.01.2018 13:40:18] [debug] ESP+00000020: ff8f22c4 00000000 f740f220 00000005
[28.01.2018 13:40:18] [debug] ESP+00000040: 00000000 00000000 00000000 00000000
[28.01.2018 13:40:18] [debug] ESP+00000060: 00000000 00000000 00000000 00000000
[28.01.2018 13:40:18] [debug] ESP+00000080: 00000000 00000000 00000000 00000000
[28.01.2018 13:40:18] [debug] ESP+000000a0: 00000000 00000000 00000000 00000000
[28.01.2018 13:40:18] [debug] ESP+000000c0: f7764000 f7712000 00000005 ff8f23c0
[28.01.2018 13:40:18] [debug] ESP+000000e0: 00000005 00000000 f747fc55 00000000
[28.01.2018 13:40:18] [debug] ESP+00000100: f7625af8 f770998c 081a18ec ff8f2418
[28.01.2018 13:40:18] [debug] ESP+00000120: f770a000 f76d4dc2 081a18ec ff8f2418
[28.01.2018 13:40:18] [debug] ESP+00000140: f770a000 081a18ec f766ca25 00000001
[28.01.2018 13:40:18] [debug] ESP+00000160: f7743c18 ff8f2414 00000000 f76348b8
[28.01.2018 13:40:18] [debug] ESP+00000180: 474e5543 8eb004a8 f766a733 8eb004a8
[28.01.2018 13:40:18] [debug] ESP+000001a0: f77576e0 f766a775 f766a7a4 8eb004c8
[28.01.2018 13:40:18] [debug] ESP+000001c0: f7668e56 f766aa79 f5c4bd34 8eb004a8
[28.01.2018 13:40:18] [debug] ESP+000001e0: f5be03b6 f5c4bd34 f5bdd976 08d78768
[28.01.2018 13:40:18] [debug] ESP+00000200: 23691928 018f24aa 170001e9 f7000000
[28.01.2018 13:40:18] [debug] ESP+00000220: 000001e9 ff8f2518 f5bdb9d7 ff8f24fc
[28.01.2018 13:40:18] [debug] ESP+00000240: 000001e9 ff8f24f0 00000009 00000002
[28.01.2018 13:40:18] [debug] ESP+00000260: 0000000b 00000005 f71f57de f7007469
[28.01.2018 13:40:18] [debug] ESP+00000280: 000001e9 ff8f2578 f5be2033 ff8f255b
[28.01.2018 13:40:18] [debug] ESP+000002a0: 00000013 ff8f25a8 ff8f25a8 000001f3
[28.01.2018 13:40:18] [debug] ESP+000002c0: 000001e9 f5c4bd34 f5c1d51b 080a5160
[28.01.2018 13:40:18] [debug] ESP+000002e0: 000001e9 ff8f25b8 f5be8e9d 08d78768
[28.01.2018 13:40:18] [debug] ESP+00000300: 08159470 ff8f25a8 0000007f 00000000
[28.01.2018 13:40:18] [debug] ESP+00000320: 0100007f ff8f2758 080d09ff 236916d8
[28.01.2018 13:40:18] [debug] ESP+00000340: f76cfeb6 258b2768 0809fbc4 258b2768
[28.01.2018 13:40:18] [debug] ESP+00000360: 2362d3d0 01050e29 00000000 0100007f
[28.01.2018 13:40:18] [debug] ESP+00000380: 0000ffff ff8f2788 01e9c51c 00000068
[28.01.2018 13:40:18] [debug] ESP+000003a0: 01000000 61724605 00006b6e 00000000
[28.01.2018 13:40:18] [debug] ESP+000003c0: 00000000 00000000 00000000 00000000
[28.01.2018 13:40:18] [debug] ESP+000003e0: 00000000 00000000 00000000 00000000
[28.01.2018 13:40:18] [debug] Loaded modules:
[28.01.2018 13:40:18] [debug] 00000000 - 00187dc3 samp03svr
[28.01.2018 13:40:18] [debug] f7742000 - f7742d0b linux-gate.so.1
[28.01.2018 13:40:18] [debug] f772f000 - f773181b /lib/i386-linux-gnu/i686/cmov/libdl.so.2
[28.01.2018 13:40:18] [debug] f7713000 - f772dd2b /lib/i386-linux-gnu/i686/cmov/libpthread.so.0
[28.01.2018 13:40:18] [debug] f7620000 - f7719cda /usr/lib/i386-linux-gnu/libstdc++.so.6
[28.01.2018 13:40:18] [debug] f75da000 - f761eb43 /lib/i386-linux-gnu/i686/cmov/libm.so.6
[28.01.2018 13:40:18] [debug] f75bd000 - f75d93c4 /lib/i386-linux-gnu/libgcc_s.so.1
[28.01.2018 13:40:18] [debug] f7410000 - f75c522f /lib/i386-linux-gnu/i686/cmov/libc.so.6
[28.01.2018 13:40:18] [debug] f7743000 - f7763d6c /lib/ld-linux.so.2
[28.01.2018 13:40:18] [debug] f73c9000 - f740bac4 plugins/crashdetect.so
[28.01.2018 13:40:18] [debug] f729f000 - f73cd461 plugins/pawnraknet.so
[28.01.2018 13:40:18] [debug] f71c9000 - f729f7f0 plugins/streamer.so
[28.01.2018 13:40:18] [debug] f7734000 - f773b09f /lib/i386-linux-gnu/i686/cmov/librt.so.1
[28.01.2018 13:40:18] [debug] f6e38000 - f71cdeb2 plugins/mysql.so
[28.01.2018 13:40:18] [debug] f6e14000 - f6e37d32 /home/kvann/samp/plugins/../log-core.so
[28.01.2018 13:40:18] [debug] f5cf3000 - f5cfe3ef /lib/i386-linux-gnu/i686/cmov/libnss_files.so.2
[28.01.2018 13:40:18] [debug] f5e02000 - f5e111d4 plugins/sscanf.so
[28.01.2018 13:40:18] [debug] f5ca5000 - f5cf1bbf plugins/FCNPC.so
[28.01.2018 13:40:18] [debug] f5c9c000 - f5ca2e84 plugins/memory.so
[28.01.2018 13:40:18] [debug] f5bb5000 - f5c9cc5b plugins/YSF.so
[28.01.2018 13:40:18] [debug] 96565000 - 96be678a plugins/RouteConnectorPlugin.so
[28.01.2018 13:40:18] [debug] 96526000 - 9655b02a /usr/lib/libtbb.so.2
[28.01.2018 13:40:18] [debug] 964fc000 - 96526340 /usr/lib/libtbbmalloc.so.2
[28.01.2018 13:40:18] [debug] 961ae000 - 962bc79b plugins/ColAndreas_static.so
[28.01.2018 13:40:18] [debug] 95d39000 - 95d53167 plugins/bcrypt-samp.so
[28.01.2018 13:40:18] [debug] 95b74000 - 95b9bd0c plugins/profiler.so
[28.01.2018 13:40:18] [debug] 9655d000 - 9656197b /lib/i386-linux-gnu/i686/cmov/libnss_dns.so.2
[28.01.2018 13:40:18] [debug] 93874000 - 9388c2fb /lib/i386-linux-gnu/i686/cmov/libresolv.so.2

Global TextDraw functions per-player

For example, TextDrawSetString sends a RPC to all players, even if they are AFK. With a TextDrawSetStringForPlayer function we could improve it and stop it from affecting AFK players, therefore limiting the RPCs in queue. It will reduce the probability for them to receive a kick for too many RPCs/packets received/sent:
'[warning] client exceeded 'messageslimit' IP:port (X) Limit: Y/sec'
'[warning] client exceeded 'messageholelimit' IP:port (X) Limit: Y'
(not sure which one of them is caused by those RPCs sent to AFK players, probably the 'messageslimit' one)

Long connection to the server

When connecting to server hangs for 5 seconds at "Сonnected. Joining the game..." and then called OnPlayerRequestClass etc.
I created a new server and connected only YSF.so, still long connection.

YSF version: R18 (R19 same problem)
Server version: 0.3.7 R2-1

Sorry for my bad English (I am from Russia).

The log is clean...

IsPlayerPaused returns wrong result

Sometimes returns true, even tho the player is not paused at all.

What did i do when it occured? I removed his vehicle, removed all streamed objects(icognito Streamer), loaded new objects and tried to spawn him with "IsPlayerPaused"as condition. At that point and time he was: Spawned, Onfoot, not paused

SAMPGDK and crash problem

Hi! I have a big problem with YSF (lastest version), when I update YSF to the current version the server prints these errors:

[06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed) [06:45:56] [sampgdk:error] Too many callback arguments (at most 32 allowed)

And approximate 30 mins the server crash (and server_log is big, more 100 MB ~ if don't delete log along days.

I have to use an old version of the YSF so it does not appear (version R16)

Thanks!!

Making a catch-all DoXForPlayer

What about hooking the RakNet broadcast method? That way, it could be customized who the next packets get sent to.

This would give a lot of flexibility to Pawn scripters.

For example:

// This would enable/disable the functionality
native SetExclusiveBroadcast(toggle);
// This would add a player to the list of who will receive the packet
native BroadCastToPlayer(playerid, toggle = true);

public OnPlayerConnect(playerid) {
    SetExclusiveBroadcast(true);
    BroadCastToPlayer(playerid);
    SetGravity(0.0);
    SetExclusiveBroadcast(false);

    return 1;
}

New crashes since R18

Hello (It's me again),
Sorry to flood you with issues, but I have narrowed a problem with the new version R18-2 of YSF.
I recently updated from R16, my server almost never crashed (or almost) before.
Now that I updated to R18-2, I have experienced 3 crashes in less than 10h of operations.
I started my server at 01:55:40 before going to sleep, it crashed at 06:53:08 the same day.
I restarted it back at 11:27:56 and it crashed again at 14:03:00, then I restarted it again at 19:09:22 and it crashed at 20:09:28. So it never been able to stay up for more than a couple hours before crashing.
Then I recompiled the same script with R16 and restarted it and it has been up with no problem for more than 12h now and I am very confident that the new version of YSF was the cause, since I only changed that and the problem disappeared.
All 3 times that the server crashed, the last thing in the log was a printf in OnPlayerDisconnect, so I suspect something in there, also, there is a message like [part] Player_Name has left the server (X:X) that is supposed to come on, it's not, my OnPlayerDisconnect is executed, but the server crashed before officially writing the player disconnection in the server_log (the message generated by SAMP itself).
Crashdetect is installed and I have tested it, but nothing comes out with those crashes, the last thing I know is that OnPlayerDisconnect was executed.

Thank you,
rt-2

GetVehicleNumberPlate

i get number plate like this:

new plate[16]
GetGehicleNumberPlate(vehicleid, plate);

but it shows me incorrect hieroglyphs
bandicam 2017-01-02 16-49-13-264

CreateObject calls

Createobject() and destroyobject() are a superior way of making objects that do not break placing vehicles on top of them to any streamer, but that has a issue since it is visible in all virtual worlds.

Ability to call the createobject rpc directly per player would be of much use, it would allow us to have streaming based only on virtual worlds - which would be a foolproof way of placing vehicles on top of objects in them.

SendRCONReply

Function to send a reply to a RCON console when using OnRemoteRCONPacket. Possibly also a function to send a reply to all connected consoles if that is possible.

Armor and health pulsing in car.

For some people this is happening and didnt see pattern for when its happening.
Armor and health is pulsing like with s0beit hack, but its not the hack. Because if someone else enters same car after that person, its happening for him too.
And car health was increasing too. It was a big number and kept growing.
http://i.imgur.com/XSqHqbs.jpg

QueryFlood wrong check

bool CheckQueryFlood(unsigned int binaryAddress)
{
    static DWORD dwLastQueryTick = 0;
    static unsigned int lastBinAddr = 0;

    if (!dwLastQueryTick) {
        dwLastQueryTick = (DWORD)GetTickCount();
        lastBinAddr = binaryAddress;
        return 0;
    }
    if (lastBinAddr == binaryAddress) { // Probably should be !=
        return 0;
    }
    if ((GetTickCount() - dwLastQueryTick) < 25) {
        return 1;
    }
    dwLastQueryTick = GetTickCount();
    lastBinAddr = binaryAddress;
    return 0;
}
  • Also the ban checking in RCON Packets seems not to work. Client was able to flood me eaven when he was banned. I had to disable rcon console
  • And also, the flood somehow caused both stack and heap underflow.

Would it help?

If i don't wanna use some functions of YSF like it's interference with DIALOGS and other things I just want that HidePlayerForPlayer and ShowPlayerForPlayer Functions, Gravity Functions. So commenting other functions would help?

0.3.DL notes and issues

Since I cannot post these on the forum, I shall do so here, in hope that either Kalcor or YSF fixes them. Feel free to post your own issues you have found in the code.

  • AddSimpleModel & co. uses calloc to create CModelInfo, but it doesn't seem to free the memory if the creation fails (file not found). [not fixable without rewriting the code].
  • The same code returns 0 on failure (bad file), -1 on allocation fail, or any non-negative value for success. 0 is therefore also returned for the first model. [not fixable without changing the code and API]
  • Again in the same place, CArtList's size increases linearly instead of geometrically. The list has dynamic size and is reallocated every time a new model info is inserted, but the size is increased by 1 every time, resulting in 10000 calls to realloc for 10000 model insertions. The standard method is to double the size each time. [fixable by hooking the resize function]

OnPlayerSend/ReceivePacket / OnPlayerSend/ReceiveRPC

Originally created here: #7


I made this suggestion on forums too (a little bit different): http://forum.sa-mp.com/showpost.php?p=3736888&postcount=73 . I think it's more organised if it is here. A callback is even better, without having the plugin to store the last X packets/RPCs.

Those callbacks should have the parameters ( playerid, rpcid/packetid, details[ ] ) . Anyway, I still don't know how the details string should look.

EDIT: It could even be something like

forward OnPlayerDataTransfer( playerid, type, id, direction, details[ ] );
// type: 0 - Packet, 1 - RPC
// id: the ID of the Packet/RPC
// direction: 0 - Sent, 1 - Received
// details: I don't know, what data is sent/received, I don't know if it should be an array instead, but you need all Packets and RPCs informations

SendBulletData on linux

SendBulletData does not function on linux, regardless of whatever i try, it works on windows only.

windows:
YSF - pNetGame: 0x2E9F08, pRakServer: 0x2EE410

linux:
YSF - pNetGame: 0x8306BD0, pRakServer: 0x830A8E0

Index Mismatch

Server log gets spammed with these two.

[18:30:32] [sampgdk:warning] Index mismatch for OnPlayerLeaveGangZone (-10094 != -10034)
[18:30:32] [sampgdk:warning] Index mismatch for OnPlayerStatsAndWeaponsUpdate (-10106 != -10046)

Seconds one spams more frequently.

Crashing

Server crashes when it restarts:
Log:
[17:45:21] [debug] Server crashed while executing XPlay.amx
[17:45:21] [debug] AMX backtrace:
[17:45:21] [debug] #0 native ShowPlayerDialog () from YSF.DLL
[17:45:21] [debug] #1 00003a70 in public OnGameModeExit () at D:\samp\Developing\Gamemodes\Z-Game\pawno\include\fixes.inc:3613
[17:45:21] [debug] Native backtrace:
[17:45:21] [debug] #0 006452b0 in ?? () from plugins\YSF.DLL
[17:45:21] [debug] #1 004010b6 in ?? () from samp-server.exe

in fixes.inc there is ShowPlayerDialog() func at OnGameModeExit()

Breaks NetStats_ConnectionStatus

NetStats_ConnectionStatus once ysf is loaded starts to return what looks like garbage.

[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at negative index -1454227448

-1454227448 is result from NetStats_ConnectionStatus which should be only one of 0 - 10 positive values found here: http://wiki.sa-mp.com/wiki/Connectionstatus

Which hook is responsible for this?

SetPlayerName return problem

SetPlayerName return values:

1 The name was changed successfully
0 The player already has that name
-1 The name can not be changed (it's already in use, too long or has invalid characters)


It returns the good values without this plugin, but with it I get only the 0 and 1 returns:

For '[SG]stuntman' SetPlayerName returned '1' .
For 'test' SetPlayerName returned '1' .
For '[test]' SetPlayerName returned '1' .
For '@$' SetPlayerName returned '1' .
For '@
$%' SetPlayerName returned '1' . <- Should return -1 (invalid) as it does without YSF. Doesn't actually change the name anyway.
For 'helloworld' SetPlayerName returned '1' .
For '>test' SetPlayerName returned '1' . <- Should return -1 (invalid) as it does without YSF. Doesn't actually change the name anyway.
For 'test' SetPlayerName returned '1' .
For 'test' SetPlayerName returned '0' .
For 'testdsasadkdsakjdsajjkasaddsds' SetPlayerName returned '1' . <- Should return -1 (too long) as it does without YSF. Doesn't actually change the name anyway.

As I can see in the Scripting.cpp code, you ALWAYS return 1 if SetPlayerName returns NON-ZERO. You should return SetPlayerName's return value (with plugin's name validity check). Also, you should reset player's name for other players only if SetPlayerName returned 1.

Maybe you should also make SetPlayerNameForPlayer support those return values ? (I don't actually use this function)


How I discovered this (creative players discovering things again): I have a name changing system based on those returns and it messed up some players accounts (who changed to invalid names). They complained that they were able to change names to things like "#invisible ||" and "J O H N C E N A" as SetPlayerName returns 1 and the script updates the player's database row's name because of it. When he connects with that new name (which wasn't set in-game the last time but got updated in database because of return 1) SA:MP tells him that his name is invalid, as it should. Result: the player lost his account and I have to manually change his account's name to a valid one directly from the database.


TL;DR: Bug: SetPlayerName never returns -1.

RPC counters

If raknet has ability to have this internally - ability to get a counter of how many RPCs are waiting for ack by a client, for monitoring sync stability.

Server crash

I'm using R19, samp 0.3.7-R2 on Linux debian 8.
my plugins crashdetect.so YSF.so streamer.so mysql.so

Crash log :

[04:10:21] [debug] Server crashed due to an unknown error
[04:10:21] [debug] Native backtrace:
[04:10:21] [debug] #0 ede82e8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[04:10:21] [debug] #1 ede7bbcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[04:10:21] [debug] #2 ede7cdbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[04:10:21] [debug] #3 ede7d226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[04:10:21] [debug] #4 ede82adc in ?? () from plugins/crashdetect.so
[04:10:21] [debug] #5 ee1d6410 in __kernel_rt_sigreturn () from linux-gate.so.1
[04:10:21] [debug] #6 ee1d6430 in __kernel_vsyscall () from linux-gate.so.1
[04:10:21] [debug] #7 eded4367 in gsignal () from /lib32/libc.so.6
[04:10:21] [debug] #8 eded5a23 in abort () from /lib32/libc.so.6
[04:10:21] [debug] #9 ee103a15 in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib32/libstdc++.so.6
[04:10:21] [debug] #10 ee101733 in ?? () from /usr/lib32/libstdc++.so.6
[04:10:21] [debug] #11 ee1017ad in ?? () from /usr/lib32/libstdc++.so.6
[04:10:21] [debug] #12 ee101ad6 in __cxa_rethrow () from /usr/lib32/libstdc++.so.6
[04:10:21] [debug] #13 eddfd4bf in _ZNSt10_HashtableItSt4pairIKtSt13unordered_mapIhSsSt4hashIhESt8equal_toIhESaIS0_IKhSsEEEESaISB_ENSt8__detail10_Select1stES5_ItES3_ItENSD_18_Mod_range_hashingENSD_20_Default_ranged_hashENSD_20_Prime_rehash_policyENSD_17_Hashtable_traitsILb0ELb0ELb1EEEE21_M_insert_unique_nodeEjjPNSD_10_Hash_nodeISB_Lb0EEE () from plugins/YSF.so
[04:10:21] [debug] #14 eddfd62a in _ZNSt8__detail9_Map_baseItSt4pairIKtSt13unordered_mapIhSsSt4hashIhESt8equal_toIhESaIS1_IKhSsEEEESaISC_ENS_10_Select1stES6_ItES4_ItENS_18_Mod_range_hashingENS_20_Default_ranged_hashENS_20_Prime_rehash_policyENS_17_Hashtable_traitsILb0ELb0ELb1EEELb1EEixEOt () from plugins/YSF.so
[04:10:21] [debug] #15 eddfbbed in ?? () from plugins/YSF.so
[04:10:21] [debug] #16 edd46562 in sampgdk_SetPlayerObjectMaterialText () from plugins/streamer.so
[04:10:21] [debug] #17 edd92967 in _ZN8Streamer14processObjectsER6PlayerRKSt6vectorIN5boost13intrusive_ptrI4CellEESaIS6_EE () from plugins/streamer.so
[04:10:21] [debug] #18 edd96197 in _ZN8Streamer19performPlayerUpdateER6Playerb () from plugins/streamer.so
[04:10:21] [debug] #19 edd9688a in _ZN8Streamer20startAutomaticUpdateEv () from plugins/streamer.so
[04:10:21] [debug] #20 edd5f415 in ProcessTick () from plugins/streamer.so
[04:10:21] [debug] #21 080d1ce2 in ?? () from ./samp03svr
[04:10:21] [debug] #22 080aef6c in ?? () from ./samp03svr
[04:10:21] [debug] #23 080aa13a in ?? () from ./samp03svr
[04:10:21] [debug] #24 edebfa63 in __libc_start_main () from /lib32/libc.so.6

Edit : I disabled StorePlayerObjectsMaterial and it's ok know

GetVehicleNumberPlate

GetVehicleNumberPlate(vehicleid, plate[], len = sizeof(plate));

This func writes an emtpy string into plate[], if SetVehicleNumberPlate() isn't called ever before.
I suggest set default number "XYZSR998" for every vehicle at creating.

Hiding and Showing player for other players

So I did try a code to hide player and then show it.

It worked fine the hiding part when it was called by a command what happened wrong was, when a player is show back by ShowPlayerForPlayer(i,playerid); that player sees our skin as CJ skin so it's not synced.
For this I had to set the players skin again.

Another was when I used these functions on Player Spawn.

if(HidePlayer[playerid])
	{
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			if(pAdmin[i]) continue;
			HidePlayerForPlayer(i,playerid);
		}
	}
	else
	{
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			ShowPlayerForPlayer(i,playerid);
		}
	}

This code won't work somehow.

SetVehicleToRespawn - crash server

My server crash after calling the function SetVehicleToRespawn.
I created a new server and connected only YSF.so, still crash.
Crash ONLY on Linux.

Sorry for my bad English (I am from Russia).

Hosting: myarena.ru
Plugins: crashdetect.so YSF.so mysql.so audio.so streamer.so pawncmd.so sscanf.so
Log (with crashdetect):

[20:34:35] [debug] Server crashed while executing gm.amx
[20:34:35] [debug] AMX backtrace:
[20:34:35] [debug] #0 native SetVehicleToRespawn () from samp03svr
[20:34:35] [debug] #1 0000bbac in SetVehicleToRespawnEx (vehid=89, number_plate[]=@00c91dc0 "VECTOR", Float:health=1000.00000) at d:\gta_servers\samp\vector_dm\0.3.7-R2\project_windows\pawno\include\svr_funcs.inc:482
[20:34:35] [debug] #2 00085434 in public OnDialogResponse (playerid=0, dialogid=500, response=1, listitem=13, inputtext[]=@00caae4c "") at d:\gta_servers\samp\vector_dm\0.3.7-R2\project_windows\gamemodes\gm.pwn:8467
[20:34:35] [debug] Native backtrace:
[20:34:35] [debug] #0 f73d39f0 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[20:34:35] [debug] #1 f73cca62 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[20:34:35] [debug] #2 f73cd764 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[20:34:35] [debug] #3 f73cf6b4 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[20:34:35] [debug] #4 f73d331d in ?? () from plugins/crashdetect.so
[20:34:35] [debug] #5 ffffe410 in ?? ()
[20:34:35] [debug] #6 0814b4c2 in ?? () from ./samp03svr
[20:34:35] [debug] #7 080d6a6e in ?? () from ./samp03svr
[20:34:35] [debug] #8 080950e4 in ?? () from ./samp03svr
[20:34:35] [debug] #9 f73ce4d3 in ZN11CrashDetect13DoAmxCallbackEiPiS0 () from plugins/crashdetect.so
[20:34:35] [debug] #10 00caae4c in ?? () from xlHvl{��{��}��{��~������m�

OnPlayerStateChange

I'm using R18, samp 0.3.7-R2 on Linux debian 8.
Befor using YSF, PLAYER_STATE_WASTED was call in OnPlayerStateChange when player die.
Not when using plugin.
It's bug or i miss something ?

0.3.DL Structs

Discussion about 0.3.DL Structs

I was found some changes in CPlayer and CPlayerPool structs. Look at here: ziggi/FCNPC@2871b18
But it's need more research.

CHookRakServer::Send RebuildSyncData hook

Would it be possible to - in a lightweight manner override bitstream data there and for ID_PLAYER_SYNC and ID_VEHICLE_SYNC override the synced keys?

I'd just need to seek specific amout of bytes to reach wKeys for the player and vehicle sync, write a zero for keys and pass the packet forward.

Any help to do this will be much appreciated.

PerPlayer ShowPlayerMarkers and LimitPlayerMarkerRadius (can be get with GetServerSettings)

ShowPlayerMakers and LimitPlayerMarkerRadius can be set only globally. It would be really useful to be able to use them per-player, so we wouldn't need to use SetPlayerMarkerForPlayer everytime to make other players disappear when we don't want them on radar.
ShowPlayerMakersForPlayer and LimitPlayerMarkerRadiusForP (the full name would exceed 31 characters) ?

I hope it is possible.


Also, a bit offtopic, I think that the YSF.inc file should be here, on GitHub, too.

Vehicle misc sync

Some vehicles have special so called "misc" component (If you ever edited any vehicle model like tow truck or plane you know what i mean). Or you can use GGMM tool to explore these.

Misc is mostly moved with 8 and 2 on keypad, packer has one, forklift, tow truck, tractor...All planes also have misc, im not sure if i remember it right but im pretty sure its rear wings for them (unless they dont have it at all but think they do). And interesting thing is that cargo bob has one too.

Now these "misc" things they are synced in samp, but i dont know how and in what way...I through it was same as with hydras thrusters but its not...(At least from simple tests with GetPlayerHydraReactorAngle).

Anyone willing to dig thru vehicle syncing and try to find these so we can detect positions of these things?

SendFormatMessage(ToAll)

native SendFormatMessage(playerid, color, const message[], {Float,}:...);
native SendFormatMessageToAll(color, const message[], {Float,
}:...);

I think its very useful in this plugin, and comfortable with using RPC.

RakSamp-ból másoltam, szerintem ez az :d

void SendClientMessage(PLAYERID playerID, DWORD dwColor, char* szMessage, ...)
{
va_list va;
va_start(va, szMessage);
char szBuffer[512] = { 0 };
vsprintf(szBuffer, szMessage, va);
va_end(va);

RakNet::BitStream bsParams;
DWORD dwStrLen = strlen(szBuffer);

bsParams.Write(dwColor);
bsParams.Write(dwStrLen);
bsParams.Write(szBuffer, dwStrLen);
pRakServer->RPC(&RPC_ClientMessage, &bsParams, HIGH_PRIORITY, RELIABLE,
    0, pRakServer->GetPlayerIDFromIndex(playerID), FALSE, FALSE, UNASSIGNED_NETWORK_ID, NULL);

}

Crash

[18:54:31] [debug] Server crashed while executing mapeditor2.amx
[18:54:31] [debug] AMX backtrace:
[18:54:31] [debug] #0 native EditDynamicObject () from streamer.so
[18:54:31] [debug] #1 00055bec in public GDialog_4000 (0, 1, -1, 3591972) from mapeditor2.amx
[18:54:31] [debug] #2 native CallLocalFunction () from samp03svr
[18:54:31] [debug] #3 0000bd94 in public OnDialogResponse (0, 4000, 1, -1, 3591964) from mapeditor2.amx
[18:54:31] [debug] Native backtrace:
[18:54:31] [debug] #0 e7a4ee8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[18:54:31] [debug] #1 e7a47bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[18:54:31] [debug] #2 e7a48dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[18:54:31] [debug] #3 e7a49226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[18:54:31] [debug] #4 e7a4eadc in ?? () from plugins/crashdetect.so
[18:54:31] [debug] #5 e7dad410 in __kernel_rt_sigreturn () from linux-gate.so.1
[18:54:31] [debug] #6 e7dad430 in __kernel_vsyscall () from linux-gate.so.1
[18:54:31] [debug] #7 e7aa1367 in gsignal () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[18:54:31] [debug] #8 e7aa2a23 in abort () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
[18:54:31] [debug] #9 e7ccfa25 in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[18:54:31] [debug] #10 e7ccd733 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[18:54:31] [debug] #11 e7ccd7ad in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[18:54:31] [debug] #12 e7ccdace in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[18:54:31] [debug] #13 e5f913ff in _ZNSt8__detail9_Map_baseIhSt4pairIKhNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEESaIS9_ENS_10_Select1stESt8equal_toIhESt4hashIhENS_18_Mod_range_hashingENS_20_Default_ranged_hashENS_20_Prime_rehash_policyENS_17_Hashtable_traitsILb0ELb0ELb1EEELb1EEixEOh () from plugins/YSF.so
[18:54:31] [debug] #14 e5f8f75c in ?? () from plugins/YSF.so
[18:54:31] [debug] #15 e79ac052 in sampgdk_SetPlayerObjectMaterialText () from plugins/streamer.so
[18:54:31] [debug] #16 e7a02ef7 in _ZN8Streamer13streamObjectsER6Playerb () from plugins/streamer.so
[18:54:31] [debug] #17 e7a06889 in _ZN8Streamer24performPlayerChunkUpdateER6Playerb () from plugins/streamer.so
[18:54:31] [debug] #18 e7a0aeea in _ZN8Streamer17startManualUpdateER6Playeri () from plugins/streamer.so
[18:54:31] [debug] #19 e79f080e in _ZN7Natives17EditDynamicObjectEP6tagAMXPi () from plugins/streamer.so
[18:54:31] [debug] #20 080950e4 in ?? () from samp03svr
[18:54:31] [debug] #21 e7a4a94b in ZN11CrashDetect13DoAmxCallbackEiPiS0 () from plugins/crashdetect.so
[18:54:31] [debug] #22 e7a4d8f8 in ?? () from plugins/crashdetect.so
[18:54:31] [debug] #23 e7a51916 in amx_Exec () from plugins/crashdetect.so
[18:54:31] [debug] #24 e7a49be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[18:54:31] [debug] #25 e7a4d659 in ?? () from plugins/crashdetect.so
[18:54:31] [debug] #26 e79a7826 in ?? () from plugins/streamer.so
[18:54:31] [debug] #27 080dfd62 in ?? () from samp03svr
[18:54:31] [debug] #28 080950e4 in ?? () from samp03svr
[18:54:31] [debug] #29 e7a4a94b in ZN11CrashDetect13DoAmxCallbackEiPiS0 () from plugins/crashdetect.so
[18:54:31] [debug] #30 e7a4d8f8 in ?? () from plugins/crashdetect.so
[18:54:31] [debug] #31 e7a51916 in amx_Exec () from plugins/crashdetect.so
[18:54:31] [debug] #32 e7a49be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[18:54:31] [debug] #33 e7a4d659 in ?? () from plugins/crashdetect.so
[18:54:31] [debug] #34 e79a7826 in ?? () from plugins/streamer.so
[18:54:31] [debug] #35 080a682f in ?? () from samp03svr
[18:54:31] [debug] #36 e5f6c921 in _Z32HOOK_CGameMode__OnDialogResponseP9CGameModeiiiiPc () from plugins/YSF.so
[18:54:31] [debug] #37 080b2c44 in ?? () from samp03svr
[18:54:31] [debug] #38 08071d38 in ?? () from samp03svr
[18:54:31] [debug] #39 08071e32 in ?? () from samp03svr
[18:54:31] [debug] #40 0807bc50 in ?? () from samp03svr
[18:54:31] [debug] #41 e5f5b839 in _ZN14CSAMPFunctions7ReceiveEPv () from plugins/YSF.so
[18:54:31] [debug] #42 080aed3d in ?? () from samp03svr
[18:54:31] [debug] #43 080aef02 in ?? () from samp03svr
[18:54:31] [debug] #44 080aa13a in ?? () from samp03svr
[18:54:31] [debug] #45 e7a8ca63 in __libc_start_main () from /lib/i386-linux-gnu/i686/cmov/libc.so.6

License

Hi, I would like to use some of your code (adresses and structures in server and related functions) in my plugin, but there is no license here. Would you mind me using it? And could you write a license or use some generic one?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.