Giter Club home page Giter Club logo

samp-streamer-plugin's Introduction

SA-MP Streamer Plugin

GitHub Release Build Status

This plugin streams objects, pickups, checkpoints, race checkpoints, map icons, 3D text labels, and actors at user-defined server ticks. Basic area detection is also included. Because it is written entirely in C++, much of the overhead from PAWN is avoided. This streamer, as a result, is quite a bit faster than any other implementation currently available in PAWN.

Documentation

Documentation can be found on the wiki.

Download

The latest binaries for Windows and Linux can be found on the releases page.

samp-streamer-plugin's People

Contributors

0x416c69 avatar agraber avatar am9029 avatar amyrahmady avatar istuntmani avatar mick88 avatar misiur avatar samp-incognito avatar southclaws avatar tommyb123 avatar uint32 avatar vsergeenko777 avatar woutprovost avatar xunder-matth avatar y-less avatar zeex 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  avatar  avatar  avatar  avatar  avatar

Watchers

 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

samp-streamer-plugin's Issues

Disappearing/Not creating

Currently, I'm using version <= 2.7.4 version, I'm not sure, but there is the deal: In this version, my objects are disappearing after some time, and they are lowering their maximum stream distance automatically. It sounds quite simple, but it's doing spontaneously.

So i decided to update to version 2.7.5(.1). But it's not working neither.
Server log says:
[22:36:51] [sampgdk:warning] Native function not found: GetPlayerState
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native function not found: GetPlayerInterior
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native function not found: GetPlayerVirtualWorld
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native function not found: GetPlayerPos
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native stub
[22:36:51] [sampgdk:warning] Native stub

I have no idea what I changed and where, but it really pisses me off.

Possible Rotation Bug

I updated to 2.7.5 at the weekend and after doing so got reports that object rotations were messing up for some players. According to these guys it's only after using the server's admin /duty command which probably involved spectating too.

Streamer crash with sampgdk on windows[Maybe linux too]

Finally I could find out the main problem with streamer.

I call streamer hooks normally with InvokeNative but when the executing line arrives at streamer code in internal.cpp :

        case STREAMER_OPC:
    { 
        CHECK_PARAMS(2, "Streamer_CallbackHook"); 
        cell *playerid = NULL; 
        amx_GetAddr(amx, params[2], &playerid); //THIS CAUSE THE CRASH
        sampgdk::logprintf("Streamer_CallbackHook4  ppid %d", playerid);
        return static_cast<cell>(core->getCallbacks()->OnPlayerConnect(static_cast<int>(*playerid)));
                        sampgdk::logprintf("Streamer_CallbackHook5");
    }

after amx_GetAddr the playerid is still null so accessing the address that it points too cause crash on next line >> *playerid

Don't know if this is a streamer problem or GDK so I posted it on GDK page too.
Please close it if it's unrelated with streamer code or please shed some light if you know anything!

Add code to the include

Add to the streamer.inc:

#if defined _streamer_included
    #endinput
#endif
#define _streamer_included

Using the YSI 4.0 causes synchronization problems with streamer.inc

Since I updated to 2.7.5, server has been sorta freezing.

I don't know what's doing this, I have no clear helpful data or anything, all I know is that after awhile, no players can connect its like it's frozen. The samp03svr doesn't terminate (debian 7)

I don't know if this is incompatibility with MySQL (R39-2), streamer (2.7.5), sampgdk and crashdetect (4.15.1).

I believe this issue has something to do with running crashdetect with these plugins.

EDIT: Maybe I should've reported this to Zeex.

EDIT: R39-2 not R9-2 woops

IsPointInAnyDynamicArea and IsPlayerInAnyDynamicArea

Both of these functions are not of much use without returning which dynamic zone handle that was found, i suggest that these 2 functions return -1 when none was found and an actual handle of the dynamic area that was found otherwise.

I understand that areas might overlap, but returning first handle that was found would be perfectly useable for 99% of scripter's needs.

Streamer_Get*Data doesn't work with newly added attached object functions

In advanced:

You can't get attached object attached object id, and I think that this is true for newly added AttachDynamicObjectToPlayer - you won't able to get attached player.

You should update these functions to accept attached object id & attached player at STREAMER_TYPE_OBJECT

E_STREAMER_ATTACHED_OBJECT,
E_STREAMER_ATTACHED_PLAYER,

Update sampgdk

I don't exactly know why, but sampgdk doesn't play nicely when it comes to different amalgamation versions in different plugins. Since sampgdk was updated to v4.3 and I updated my plugin to use this version, I get lots of warnings (ikkentim/SampSharp#113).

To fix this, I tried updating your plugin to sampgdk v4.3 and this seems to fix my issue. That would mean that v4.3 (which I use) is not compatible with v4.2.2 (which you use).

I post this issue here to make people aware of this possible incompatibility. If you want, you can simply merge this this branch: https://github.com/ikkentim/samp-streamer-plugin/tree/patch-1

Defining default values for stream/draw distances

I think that it would be a good idea to have defines for the default stream/draw distances of objects (maybe other types too), because everytime I update the streamer I need to modify the stream/draw distance of the objects ( CreateDynamicObject(Ex) ) to the ones I use.

Something like this in the include:

// Top
#if !defined STREAMER_DEFAULT_OBJECT_STREAMDISTANCE
    #define STREAMER_DEFAULT_OBJECT_STREAMDISTANCE 300.0
#endif

>#if !defined STREAMER_DEFAULT_OBJECT_DRAWDISTANCE
    #define STREAMER_DEFAULT_OBJECT_DRAWDISTANCE 0.0
#endif

>// Functions
native STREAMER_TAG_OBJECT CreateDynamicObject( ... , Float:streamdistance = STREAMER_DEFAULT_OBJECT_STREAMDISTANCE, Float:drawdistance = STREAMER_DEFAULT_OBJECT_DRAWDISTANCE);
// for CreateDynamicObjectEx too

So we could simply add the defines before including the streamer instead of changing the include everytime.

Easyer way to get object material type

It would be very good to get object material type, which in use in given slot.

Like: nothing, material, material text

It's already in samp server, but not aviable for pawn. I made this with YSF and would be good for streamer plugin too, You can just implement this native for dynamic objects. (Do not try to call this native from ysf :D )

Where it would be good? In my server possible to attach 70 objects for every vehicle, one object can have 16 materials, and server can have up to 2k vehicles.

gVehicleObjectMaterial[2000][70][16] <- this is VERY HORRIBLE

Example: https://github.com/kurta999/YSF/blob/YSF_/src/Scripting.cpp#L2381

Streamer in conflict with sampGDK

After 10 days of working with sampGDK I couldn't find any way to hook all callbacks(sa-mp natives and also plugin callbacks).
Then I decided to look into streamer code and I found that breaking after following line is in conflict with generic hooking amx_FindPublic and amx_Exec

     if (p->second->amx != interface)

I have commented all breaks after this line and now sampGDK can interop normally.
Either you should choose a different way for what you are achieving with that break or should forget about breaking. Otherwise this plugin won't be usable alongside sampGDK.
Hint : sampGDK uses a fake amx instance which this might be related with this problem.

Objects dissapear randomly

What steps will reproduce the problem?

  1. Update player pos, entering interiors

What is the expected output? What do you see instead?
When I'm entering interiors and exiting them, objects outside (not all) just disappear and shows until we moves to other place which is away from last place.

What version of the product are you using? On what operating system?
v2.7.2 Win7 x64

Please provide any additional information below.
When max visible items is set to 999 this occur, when default 500, all is ok..

OnPlayerLeaveDynamicArea callback executes after OnPlayerEnterDynamicArea

sa-mp ver. R4-1000p
streamer ver. 2.7.3

OnPlayerEnterDynamicArea -> | areaid = 12 <- stay on this area
OnPlayerEnterDynamicArea -> | areaid = 211 <- stay on this area

OnPlayerEnterDynamicArea -> | areaid = 166 <- teleporting area
OnPlayerEnterDynamicArea -> | areaid = 167 <- entering area (after teleport)
OnPlayerLeaveDynamicArea <- | areaid = 12
OnPlayerLeaveDynamicArea <- | areaid = 166
OnPlayerLeaveDynamicArea <- | areaid = 211

OnPlayerShootDynamicObject

OnPlayerShootDynamicObject is not called from the last version (i think).

public OnPlayerShootDynamicObject(playerid, weaponid, objectid, Float:x, Float:y, Float:z)
{
if(!IsValidDynamicObject(objectid))
return 1;
SendClientMessage(playerid, -1, "OnPlayerShootDynamicObject");
return 1;
}
The message is not show.

Gang zone streamer?

Since YSF, we can use per-player gang zones. I'm interested that somebody would use more than 1024 gang zones? Because if yes, then I could do it in my forked version where i'm working on vehicle streamer, and if it would be good, maybe Incognito will merge it :D

Plus I heard that game start lagging with lot of gang zones, this is true? If yes, then create streamer for gangzones are useless.

Get Object Model

Since SA-MP 0.3.7 RC1 we can use GetObjectModel(), GetPlayerObjectModel(). Can u add GetDynamicObjectModel & GetDynamicPlayerObjectModel?

special objects streamdistance support

streamdistance could be set to something high like 100000 - That would indicate that the object is NOT distance streamed (omit from all distance checks) in a way that would not impact streaming performance (such objects would be used sparingly too).

This way, a dynamic object could be always streamed-in - but only in a specific virtual world.
This has a lot of uses such as to ensure that specific areas made of dynamic objects are absolutely always there to prevent spawned cars from falling thru them and causing gameplay problems.

[bug] Streamer crashes the server if call samp Kick function from sampgdk

I'm using latest sampgdk version, the problem with calling callback OnPlayerDisconnect when using Kick is solved but sometimes now I get a exception of attempt to read/write protected memory!

It's like related to streamer..
Problem Event Name: APPCRASH
Application Name: samp-server.exe
Application Version: 0.3.6.0
Application Timestamp: 52fc71b4
Fault Module Name: streamer.DLL
Fault Module Version: 2.7.0.0
Fault Module Timestamp: 52e7f30f
Exception Code: c0000005
Exception Offset: 0000ebc1
OS Version: 6.2.9200.2.0.0.256.4
Locale ID: 1033
Additional Information 1: e00f
Additional Information 2: e00ff5d5afb09c9691538e3324d69a4d
Additional Information 3: d456
Additional Information 4: d45628be9c6c974490440abc7fb6534e

Update sampgdk

Could you update the plugin with the latest version of sampgdk? This would fix a bunch of compatibility issues with other plugins.

Either with the yet-to-be-released sampgdk v4.2.2 or simply build sampgdk from master.

CreateDynamicCP and CreateDynamicRaceCP

How best to use a variable to in OnPlayerEnterDynamicCP and OnPlayerEnterDynamicRaceCP?
new cp[MAX_PLAYERS][2]; and new cp[2][MAX_PLAYERS];
And whether they should be cleaned after removal?

AttachDynamicObjectToObject problem

I've been trying to find fix to this problem for few days now and I haven't found anything.
Here's the problem. I have this function which should create three objects and attach two of them to the first object.

CreateBillboard(2, 2048.7175,1360.0249,10.6719,5.0234); // this is called under OnGgameModeInit
stock CreateBillboard(Type, Float:X, Float:Y, Float:Z, Float:rZ) // function located in an include file
{
    new id = -1;
    for(new i; i<MAX_BILLBOARDS; i++)
    {
        if(Board[i][Created] == false)
        {
            id = i;
            break;
        }
    }
// billboard
Board[id][Object][0] = CreateDynamicObject(1260, X, Y, Z, 0.0, 0.0, 0.0);

// black background 1
Board[id][Object][1] = CreateDynamicObject(7901, X + 0.3, Y - 0.1, Z + 5.6, 0.0, 0.0, 270.0);
SetDynamicObjectMaterialText(Board[id][Object][1], 0, "Your ad \ncan be here", 50, "Arial", 11, 1, 0xFFFF8200, 0xFF000000, 1);


AttachDynamicObjectToObject(Board[id][Object][1], Board[id][Object][0], 0.3, -0.1, 5.6, 0.0, 0.0, 270.0, true);

// black background 2
Board[id][Object][2] = CreateDynamicObject(7901, X + 0.7, Y - 0.1, Z + 5.6, 0.0, 0.0, 90.0);
SetDynamicObjectMaterialText(Board[id][Object][2], 0, "Your ad \ncan be here", 50, "Arial", 11, 1, 0xFFFF8200, 0xFF000000, 1);

AttachDynamicObjectToObject(Board[id][Object][2], Board[id][Object][0], 0.7, -0.1, 5.6, 0.0, 0.0, 90.0, true); // <---- this is the line which caused the crash

// after setting all the coordinates, I'm just rotating the object with the correct offsets of the last two objects
SetDynamicObjectRot(Board[id][Object][0], 0.0, 0.0, rZ);

When I compile the gamemode, everything is alright. No errors or warnings.
That location is set around 20-30 meters from the spawn location and when I spawn and the objects begin to stream, my server crashes without any messages from crash detect or under OnPluginError.
But when I set the location to, let's say, few kilometers from the spawning location, objects doesn't get streamed and server doesn't crash.
I'm not sure if I gave you enough information about the problem so feel free to ask me for anything to post here and I'll do it. Cheers!

OnPlayerEnterDynamicRaceCP doesn't get called

I updated the streamer plug-in to the newest version (2.7.3), and everything seems fine. Race Checkpoints load, I get no error messages by the streamer plug-in.

But then, I can not enter any dynamic race checkpoint. When I do, OnPlayerEnterDynamicRaceCP doesn't get called. It did in 2.7.2

I haven't changed any code, and when I go back to the old version of the streamer plug-in everything is just fine.

Building on vs2012

I got trouble with building the project in Visual Studio 2012. You don't have to use the premake5 for vs2012 because vs2012 converts the project to 2012 itself before you start. It keeps buzzing me about a missing pdb file;

1> Generating Code...
1> Creating library bin\win32\Debug\streamer.lib and object bin\win32\Debug\streamer.exp
1>subhookd.lib(subhook.obj) : warning LNK4099: PDB 'subhookd.pdb' was not found with 'subhookd.lib(subhook.obj)' or at 'C:\Users\Marciano\Desktop\robin\samp-streamer-plugin\bin\win32\Debug\subhookd.pdb'; linking object as if no debug info
1>LINK : error LNK1218: warning treated as error; no output file generated

not sure if unlinking the pdb is a smart idea, so I'll avoid that for now.

OnPlayerEditDynamicObject

Hi,
I've a problem with this public.
I made a Furniture System, and with the streamer windows all go good.
But i host my server on linux and my furniture system with streamer.so have a problem with this public.

Possible memory leak?

I'm boread, and I checked your streamer.

In MoveDynamicObject I found something interesting..

cell AMX_NATIVE_CALL Natives::MoveDynamicObject(AMX *amx, cell *params)
{
CHECK_PARAMS(8, "MoveDynamicObject");
if (!amx_ctof(params[5]))
{
return 0;
}
boost::unordered_map<int, Item::SharedObject>::iterator o = core->getData()->objects.find(static_cast(params[1]));
if (o != core->getData()->objects.end())
{
if (o->second->attach)
{
sampgdk::logprintf("MoveDynamicObject: Object is currently attached and cannot be moved");
return 0;
}
Eigen::Vector3f position(amx_ctof(params[2]), amx_ctof(params[3]), amx_ctof(params[4]));
Eigen::Vector3f rotation(amx_ctof(params[6]), amx_ctof(params[7]), amx_ctof(params[8]));
o->second->move = boost::intrusive_ptrItem::Object::Move(new Item::Object::Move);
o->second->move->duration = static_cast((static_cast(boost::geometry::distance(position, o->second->position) / amx_ctof(params[5])) * 1000.0f));
o->second->move->position.get<0>() = position;
o->second->move->position.get<1>() = o->second->position;
o->second->move->position.get<2>() = (position - o->second->position) / static_cast(o->second->move->duration);
o->second->move->rotation.get<0>() = rotation;
if ((o->second->move->rotation.get<0>().maxCoeff() + 1000.0f) > std::numeric_limits::epsilon())
{
o->second->move->rotation.get<1>() = o->second->rotation;
o->second->move->rotation.get<2>() = (rotation - o->second->rotation) / static_cast(o->second->move->duration);
}
o->second->move->speed = amx_ctof(params[5]);
o->second->move->time = boost::chrono::steady_clock::now();
for (boost::unordered_map<int, Player>::iterator p = core->getData()->players.begin(); p != core->getData()->players.end(); ++p)
{
boost::unordered_map<int, int>::iterator i = p->second.internalObjects.find(o->first);
if (i != p->second.internalObjects.end())
{
StopPlayerObject(p->first, i->second);
MovePlayerObject(p->first, i->second, o->second->move->position.get<0>()[0], o->second->move->position.get<0>()[1], o->second->move->position.get<0>()[2], o->second->move->speed, o->second->move->rotation.get<0>()[0], o->second->move->rotation.get<0>()[1], o->second->move->rotation.get<0>()[2]);
}
}
core->getStreamer()->movingObjects.insert(o->second);
return static_cast(o->second->move->duration);
}
return 0;
}

o->second->move = boost::intrusive_ptrItem::Object::Move(new Item::Object::Move);

There is a memory leak, isn't? Because you never delete this pointer.

Hooking

For some reason with the new version OnPlayerEditDynamicObject() is not being called I'm not sure why this happens but other callbacks may be broken as well yes I'm using YSI too.

Too many objects?

Hello, I offten got crashes on my server with only one crash address - 0x00756B89. I think it's related to objects - crashes only at one place near Alhambra. Server have over 19.000 objects. Stream distance is set to 200.0, proccestick 50, max visible items (objects) - 900. What can I do to solve it?

Optimize variables

What would be if you would optimize variables to not use int for everything? This would save lot of memory if you use very big amount of items.

WORD for playerid

WORD for object modelid
BYTE for area type

BYTE for mapicon style, type

etc etc etc

There are lot of place where optimalization would be good.

[Question] sampgdk3.dll

As I understand you changed / rewrote "sampgdk3.dll", can you please publish the code / update it to 4th version?

[question] Premake file

You appear to have generated your Makefile with premake.
If, after generating the Makefile, haven't modified it very much, would you mind sharing your premake configuration? It would help me greatly!

My server crashes because of this plugin

Well, crashdetect says so.

I'm using the -d3 flag, and my server is mysteriously crashing after several hours. I'm not sure if it's my fault, but crashdetect logs this for me:

[17:39:10] [debug] Server crashed while executing NFS.amx
[17:39:10] [debug] AMX backtrace:
[17:39:10] [debug] #0 native Streamer_CallbackHook () [741d9830] from streamer.DLL
[17:39:10] [debug] #1 000005a8 in public OnPlayerDisconnect (playerid=0, reason=0) at C:\Users\roobi_000\Google Drive\GTA SA\NCRP\pawno\include\streamer.inc:323
[17:39:10] [debug] Native backtrace:
[17:39:11] [debug] #0 7422155f in Load () from C:\Users\root\Desktop\NFS-samp\plugins\crashdetect.DLL
[17:39:11] [debug] #1 74222844 in Load () from C:\Users\root\Desktop\NFS-samp\plugins\crashdetect.DLL
[17:39:11] [debug] #2 7422470e in Load () from C:\Users\root\Desktop\NFS-samp\plugins\crashdetect.DLL
[17:39:11] [debug] #3 75620736 in UnhandledExceptionFilter () from C:\Windows\SYSTEM32\KERNELBASE.dll
[17:39:11] [debug] #4 0049eef6 in ?? () from C:\Users\root\Desktop\NFS-samp\samp-server.exe
[17:39:11] [debug] #5 00498331 in ?? () from C:\Users\root\Desktop\NFS-samp\samp-server.exe
[17:39:11] [debug] #6 757a8543 in BaseThreadInitThunk () from C:\Windows\SYSTEM32\KERNEL32.DLL
[17:39:11] [debug] #7 77ebac69 in RtlInitializeExceptionChain () from C:\Windows\SYSTEM32\ntdll.dll
[17:39:11] [debug] #8 77ebac3c in RtlInitializeExceptionChain () from C:\Windows\SYSTEM32\ntdll.dll

I'm unsure what's happening. I thought it might be my streamer plugin being outdated, so I updated it but this still happens. Then I thought, maybe it's crashdetect bugging out the server.. So I removed that plugin, still same crash.

I'm running on a Windows server.

Anyone knows how to fix this? I'm running the latest streamer plugin and everything works, but after a few hours the server crashes.

streamer.inc wrong tag

Line 282. AttachDynamicAreaToObject has as parameter STREAMER_ALL_TAGS objectid. Should be STREAMER_TAG_OBJECT objectid

Native stub

Since version 2.7.5.1 and still in 2.7.5.2 the console is spammed with this warning:

[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub
[02/22/15/Feb 07:59:58] [sampgdk:warning] Native stub

Run time error 7: "Stack underflow"

When i updated streamer plugin (v2.7.4 >), i get run time 7 error.
With previous version (v2.7.4) works fine.

Server: 0.3.7-RC4

[17:11:10] [debug] Run time error 7: "Stack underflow"
[17:11:10] [debug] Stack pointer (STK) is 0x10E475C, stack top (STP) is 0x10E4750

OnPlayerEnterDynamicRaceCP(playerid, checkpointid)

Constant challenge checkpointid 1
What is wrong

public OnPlayerEnterDynamicRaceCP(playerid, checkpointid)
{
printf("OnPlayerEnterDynamicRaceCP (checkpointid: %i)", checkpointid);
new vehicleid = GetPlayerVehicleID(playerid);
if(checkpointid == gOilProducer[playerid][0])
{
if(!IsPlayerInAnyVehicle(playerid)) return 1;
if(PlayerInfo[playerid][pWorking] != 2)
{
SendClientMessage(playerid,CRED,"Вы не являетесь работником нефтебазы.");
RemovePlayerFromVehicle(playerid);
}
else if(!gStartingOilProducer[playerid])
{
SendClientMessage(playerid,CRED,"Для начало переоденьтесь чтобы начать рабочий день!");
RemovePlayerFromVehicle(playerid);
}
else if(GetPVarInt(playerid,"ActionCans"))
{
SendClientMessage(playerid,CRED,"Чтобы продолжить дальнейшие действие в транспорте, нужно вернуть канистру!");
RemovePlayerFromVehicle(playerid);
}
else if(GetPVarInt(playerid, "OilProducerRentID") == vehicleid)
{
if(gCarOilProducer[vehicleid] < 10)
{
DestroyDynamicRaceCP(gOilProducer[playerid][0]);
SendClientMessage(playerid, ORANGE, "Ожидайте пока загрузка завершится!");
SetTimerEx("LoadingWells",10000,false,"ii",playerid, vehicleid);
TogglePlayerControllable(playerid, 0);
}
else
{
SetPVarInt(playerid, "vehicleidoilprod", 1);
SendClientMessage(playerid, ORANGE, "Вы успешно доставили {"#cLIGHTBLUE"}10 л{"#cORANGE"} нефти!");
SendClientMessage(playerid, ORANGE, "Возвращайтесь к работе.");
gCarOilProducer[vehicleid] = 0;
Sklad[Work][0] += 10;
gOilProducerMax[playerid][1] += 1;
PlayerInfo[playerid][pWorkMark][1] += 1;
UpdateLevelWork(playerid);
format(stringsavefuel, 100, "Топлива на заводе: {FF9900}%i{ffffff} литров", Sklad[Work][0]);
UpdateDynamic3DTextLabelText(Sklad[TdWork][0], 0xFFFF00FF, stringsavefuel);
pTemp[playerid][pSetMaterial] += 1;
gOilProducerAmount[playerid] += 10;
orm_save(Sklad[wzID]);
DestroyDynamicRaceCP(gOilProducer[playerid][0]);
new rand = random(sizeof(gOilProducerPos));
gOilProducer[playerid][0] = CreateDynamicRaceCP(1, gOilProducerPos[rand][0], gOilProducerPos[rand][1], gOilProducerPos[rand][2], 0.0, 0.0, 0.0, 2.0, 0, 0, playerid, 700.0);
}
}
}
if(checkpointid == GetPVarInt(playerid,"GPS"))
{
if(GetPVarInt(playerid,"GPS") >= 1)
{
SendClientMessage(playerid,ORANGE,"Вы достигли места назначения");
DestroyDynamicRaceCP(GetPVarInt(playerid,"GPS"));
DeletePVar(playerid,"GPS");
}
}
if(checkpointid == LesopilkaMark[playerid] && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(PlayerInfo[playerid][pWorking] == 4)
{
if(pTemp[playerid][pGPSPOINTWORK][0] == 1)
{
GiveWeapon(playerid, 9,1);
LoopingAnimation(playerid, "CHAINSAW", "WEAPON_csaw", false);
SetTimerEx("OnPlayerForest", 10000, false, "i", playerid);
DestroyDynamicRaceCP(LesopilkaMark[playerid]);
}
if(pTemp[playerid][pGPSPOINTWORK][0] == 2)
{
RemovePlayerAttachedObject(playerid, 3);
PlayerAmountPack[playerid] += 1;
SendClientMessage(playerid, ORANGE, "Вы успешно доставили {"#cLIGHTBLUE"}10 кг{"#cORANGE"} дерева!");
SendClientMessage(playerid, ORANGE, "Возвращайтесь к работе.");
pTemp[playerid][pGPSPOINTWORK][0] = 1;
PlayerInfo[playerid][pWorkMark][3] += 1;
UpdateLevelWork(playerid);
pTemp[playerid][pSetMaterial] ++;
CountroWell[playerid] += 10;
Sklad[Work][1] += 10;
orm_save(Sklad[wzID]);
format(StringSklad,100, "На складе {FFFF00}%d {FFFFFF} кг. дерева", Sklad[Work][1]);
UpdateDynamic3DTextLabelText(Sklad[TdWork][1], 0xFFFFFFFF, StringSklad);
DeleteAnimation(playerid);
DestroyDynamicRaceCP(LesopilkaMark[playerid]);
new rand = random(sizeof(gForestPoint));
LesopilkaMark[playerid] = CreateDynamicRaceCP(2, gForestPoint[rand][0], gForestPoint[rand][1], gForestPoint[rand][2], 0.0, 0.0, 0.0, 2.0, 0, 0, playerid, 500);
}
}
}
return 1;
}

Compile error in Debug mod.

Hi, I'm trying to find out why streamer crashes with sampGDK so I need to compile in Debug mod.
However seems like you have forgot to add pdb file for sampgdk and also subhook too.
So visual studio gives out following error and stops compiling.

    Error   2   error LNK1218: warning treated as error; no output file generated   X:\samp-streamer-plugin-master\LINK streamer
    Warning 1   warning LNK4099: PDB 'subhookd.pdb' was not found with 'subhookd.lib(subhook.obj)' or at 'X:\samp-streamer-plugin-master\bin\win32\Debug\subhookd.pdb'; linking object as if no debug info  X:\samp-streamer-plugin-master\subhookd.lib(subhook.obj)    streamer

Streamer_GetArrayData problem

I have this code:

main()
{
new pickup = CreateDynamicPickup( PropertyVisual[ type ][ 0 ], 23, x, y, z );

new data[ 2 ];
data[ 0 ] = e_Pickup_Property;
data[ 1 ] = propid;

Streamer_SetArrayData( STREAMER_TYPE_PICKUP, pickup , E_STREAMER_EXTRA_ID, data, 2 );
Streamer_GetArrayData( STREAMER_TYPE_PICKUP, pickup , E_STREAMER_EXTRA_ID, data, 2 );

printf("propid: %d data[0]: %d pickup %d", propid, data[ 0 ], pickup);
printf("propid: %d data[1]: %d pickup %d", propid, data[ 1 ], pickup);

}

Result of prints:
propid: 1 data[0]: 1 pickup 1
propid: 1 data[1]: 1 pickup 1

All datas are 1.

public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new id, data[ 2 ];
Streamer_GetArrayData( STREAMER_TYPE_PICKUP, pickupid, E_STREAMER_EXTRA_ID, data );

va_SendClientMessage(playerid, -1, "data[0]: %d pickup %d", data[ 0 ], pickupid);
va_SendClientMessage(playerid, -1, "data[1]: %d pickup %d", data[ 1 ], pickupid);       

}

Result:
data[0]: 1 pickup 1
data[1]: 0 pickup 1

Data[1] is now 0 but should be 1 as in main.

More useful error messages

It would be useful if error messages(e.g. "Invalid ID specified") printed the backtrace. This way, it's easier for users to fix errors/bug.

This could be done using crashdetect. Crashdetect has the native " PrintAmxBacktrace" which can be executed using sampgdk::FindNative/sampgdk::CallNative.
If crashdetect is not present, simply don't print the backtrace.

The documentation of FindNative/CallNative is available at: http://zeex.github.io/sampgdk/doc/html/group__interop.html

For an overview of the natives avaiable in crashdetect:
https://github.com/Zeex/samp-plugin-crashdetect/blob/master/src/natives.cpp#L76

This suggestion was posted by Southclaw on page 499 of the plugin:
http://forum.sa-mp.com/showthread.php?t=102865&page=499

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.