[Plugin] Streamer Plugin

Quote:
Originally Posted by Abagail
Посмотреть сообщение
I am pretty sure CancelEdit applies for player objects too. Can you confirm it not to be working?
Yea nevermind what I said, tested it again here. Calling OnPlayerEditDynamicObject callback manually (with EDIT_RESPONSE_CANCEL) and then calling CancelEdit fixed my problem (If I use only CancelEdit my objects don't go back to their previous position/rotation if they are in a different world than mine (I suppose because they are not streamed since I'm in a different world in that case), that's why I'm calling the callback too). I assumed CancelEdit wouldn't work but by what you said I see dynamic objects are actually player objects, now it makes sense. But I didn't see anything saying that CancelEdit would apply to dynamic objects too... Anyways thanks for the help, Abagail.

EDIT:

Quote:
Originally Posted by Crayder
Посмотреть сообщение
CancelEdit applies for the TD mouse, objects, and player objects.
I didn't know that... Thanks you too, good to know.
Reply

Quote:
Originally Posted by BCG2000
Посмотреть сообщение
Yea nevermind what I said, tested it again here. Calling OnPlayerEditDynamicObject callback manually (with EDIT_RESPONSE_CANCEL) and then calling CancelEdit fixed my problem (If I use only CancelEdit my objects don't go back to their previous position/rotation if they are in a different world than mine (I suppose because they are not streamed since I'm in a different world in that case), that's why I'm calling the callback too). I assumed CancelEdit wouldn't work but by what you said I see dynamic objects are actually player objects, now it makes sense. But I didn't see anything saying that CancelEdit would apply to dynamic objects too... Anyways thanks for the help, Abagail.
Glad to hear it worked! A neat function for your case would be:
pawn Код:
stock CancelDynamicEdit(playerid, objectid)
{
       CallLocalFunction("OnPlayerEditDynamicObject", playerid, objectid, EDIT_RESPONSE_CANCEL, 0, 0, 0, 0, 0, 0);
       CancelEdit(playerid);
     
       return 1;
}
Reply

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Glad to hear it worked! A neat function for your case would be:
pawn Код:
stock CancelDynamicEdit(playerid, objectid)
{
       CallLocalFunction("OnPlayerEditDynamicObject", playerid, objectid, EDIT_RESPONSE_CALL, 0, 0, 0, 0, 0, 0);
       CancelEdit(playerid);
     
       return 1;
}
Yea doing it like that, works good.

EDIT: I guess it should be EDIT_RESPONSE_CANCEL instead of EDIT_RESPONSE_CALL.
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
I started to work on vehicle streamer in august, now it's in alpha state so who interested, feel free to test it. It is the latest version + vehicle streamer. There will be bugs, it's on beta stage. Trailer functions not completed yet. Who have an idea how to write the best trailer streaming, help me

pawn Код:
#define STREAMER_VEHICLE_TYPE_STATIC (0)
#define STREAMER_VEHICLE_TYPE_DYNAMIC (1)

native AttachDynamicObjectToVehicle(objectid, vehicleid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz, vehicletype = STREAMER_VEHICLE_TYPE_DYNAMIC);

forward OnDynamicVehicleSpawn(vehicleid);
forward OnDynamicVehicleDeath(vehicleid, killerid);
forward OnPlayerEnterDynamicVehicle(playerid, vehicleid, ispassenger);
forward OnPlayerExitDynamicVehicle(playerid, vehicleid);
forward OnDynamicVehicleMod(playerid, vehicleid, componentid);
forward OnDynamicVehiclePaintjob(playerid, vehicleid, paintjobid);
forward OnDynamicVehicleRespray(playerid, vehicleid, color1, color2);
forward OnDynamicVehDamageStatusUpdate(vehicleid, playerid);
forward OnUnoccupiedDynamicVehUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z);
forward OnDynamicVehicleStreamIn(vehicleid, forplayerid);
forward OnDynamicVehicleStreamOut(vehicleid, forplayerid);

native CreateDynamicVehicle(modelid, Float:fX, Float:fY, Float:fZ, Float:fRot, color1, color2, respawndelay, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 300.0);
native DestroyDynamicVehicle(vehicleid);
native IsValidDynamicVehicle(vehicleid);
native IsDynamicVehicleStreamedIn(vehicleid, forplayerid);
native GetDynamicVehiclePos(vehicleid, &Float:x, &Float:y, &Float:z);
native SetDynamicVehiclePos(vehicleid, Float:x, Float:y, Float:z);
native GetDynamicVehicleZAngle(vehicleid, &Float:z_angle);
native GetDynamicVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z);
native SetDynamicVehicleZAngle(vehicleid, Float:z_angle);
native SetDynamicVehParamsForPlayer(vehicleid,playerid,objective,doorslocked);
native SetDynamicVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
native GetDynamicVehicleParamsEx(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective);
native SetDynamicVehicleToRespawn(vehicleid);
native LinkDynamicVehicleToInterior(vehicleid, interiorid);
native AddDynamicVehicleComponent(vehicleid, componentid);
native RemoveDynamicVehicleComponent(vehicleid, componentid);
native ChangeDynamicVehicleColor(vehicleid, color1, color2);
native ChangeDynamicVehiclePaintjob(vehicleid, paintjobid);
native SetDynamicVehicleHealth(vehicleid, Float:health);
native GetDynamicVehicleHealth(vehicleid, &Float:health);
native AttachTrailerToDynamicVehicle(trailerid, vehicleid);
native DetachTrailerFromDynamicVeh(vehicleid);
native IsTrailerAttachedToDynamicVeh(vehicleid);
native GetDynamicVehicleTrailer(vehicleid);
native SetDynamicVehicleNumberPlate(vehicleid, plate[]);
native GetDynamicVehicleModel(vehicleid);
native RepairDynamicVehicle(vehicleid); // Repairs the damage model and resets the health
native GetDynamicVehicleVelocity(vehicleid, &Float:X, &Float:Y, &Float:Z);
native SetDynamicVehicleVelocity(vehicleid, Float:X, Float:Y, Float:Z);
native SetDynamicVehAngularVelocity(vehicleid, Float:X, Float:Y, Float:Z);
native GetDynamicVehicleDamageStatus(vehicleid, &panels, &doors, &lights, &tires);
native UpdateDynamicVehDamageStatus(vehicleid, panels, doors, lights, tires);

native GetPlayerSurfingDynamicVehID(playerid);
native PutPlayerInDynamicVehicle(playerid, vehicleid, seatid);
native GetPlayerDynamicVehicleID(playerid);
native IsPlayerInDynamicVehicle(playerid, vehicleid);
native IsPlayerInAnyDynamicVehicle(vehicleid);
native PlayerSpectateDynamicVehicle(playerid, targetvehicleid, mode = SPECTATE_MODE_NORMAL);
A dynamic array would be useful since vehicles id are infinity.
Reply

You can use Streamer_SetInt/Array data for that with E_STREAMER_EXTRA_ID, but that's yet not complete for vehicles. You can store array for every vehicle, so you're not limited to one variable.
Reply

And how can I store a string combined with another ints or floats.


Код:
new data[2]
data[0] = 2
data[1] = "abc" // on this index i need a string for exemple, how i can sore it?

Streamer_SetArrayData(STREAMER_TYPE_VEHICLE, vehicleid, E_STREAMER_EXTRA_ID, data);
Reply

Код:
new data[2]
data[0] = 2;
data[1] = 'a';
data[2] = 'b';
data[3] = 'c';

Streamer_SetArrayData(STREAMER_TYPE_VEHICLE, vehicleid, E_STREAMER_EXTRA_ID, data);
But this function won't work on vehicles yet, test it on objects.
Reply

Is there not a GetDynamicObjectModel() function?
Reply

Use new modelid = Streamer_GetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_MODEL_ID);
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
Use new modelid = Streamer_GetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_MODEL_ID);
Oh right, I can use the enumulator for that. Thank you.
Reply

Why this public not calling?
Quote:

OnPlayerShootDynamicObject

Reply

Quote:
Originally Posted by Tamer
Посмотреть сообщение
Oh right, I can use the enumulator for that. Thank you.
Or make it a little more pretty... (I posted this here not long ago, it can't be too far up in the pages...)

Код:
#define GetDynamicObjectModel(%0) Streamer_GetIntData(STREAMER_TYPE_OBJECT, %0, E_STREAMER_MODEL_ID)
Reply

Easyest thing would be create one simple native for that to avoid questions.

You can get objects pos & rotation by Streamer_GetFloatData, but native functions are exists for them. Same situation
Reply

I'm looking for a way to set a specific objects draw distance to a specific player.

Now assume we have a player, he has a fairly bad computer, I have streamed objects on my server, their drawdistances are set to my own liking.

However this player, lags a lot due to the objects I use (and since I am showing them at a large distance) my player wants these objects (preferably all of them) to be streamed with him when he's close to them (or closer than what my current draw distance is) so he's going to set the object's drawdistance to his own liking and decrease the FPS lag on his side, without doing any changes with other player's object visibility.

So, I can keep my current drawdistance the way I want and the players which get FPS lags, can save themselves from getting FPS drops.

Is this possible?
Reply

@Tamer: Streamer_SetRadiusMultiplier was added in v2.7.5. But I found its behaviour pretty weird, I will test it again when I will be able to. It was looking pretty buggy to me, or I didn't know how to use it. I think that the default radius multiplier is 1.00. Correct me if I am wrong.
Reply

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
@Tamer: Streamer_SetRadiusMultiplier was added in v2.7.5. But I found its behaviour pretty weird, I will test it again when I will be able to. It was looking pretty buggy to me, or I didn't know how to use it. I think that the default radius multiplier is 1.00. Correct me if I am wrong.
I never knew about this function:
Quote:

By default, the streaming radius multiplier is 1.0 for all players. This can be adjusted with Streamer_SetRadiusMultiplier. For example, a radius multiplier of 0.5 will reduce the streaming radius of all items of the type specified by half. This will require the player to be twice as close as normal before the item will begin to stream.

Reply

Gamemode does not load when I use the new versions of streamer. Server-log:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z-R4, ©2005-2014 SA-MP Team

[2015/04/01 00:17:42] filterscripts = ""  (string)
[2015/04/01 00:17:42] 
[2015/04/01 00:17:42] Server Plugins
[2015/04/01 00:17:42] --------------
[2015/04/01 00:17:42]  Loading plugin: mysql.so
[2015/04/01 00:17:42]  >> plugin.mysql: R39-3 successfully loaded.
[2015/04/01 00:17:42]   Loaded.
[2015/04/01 00:17:42]  Loading plugin: streamer.so
[2015/04/01 00:17:42] 

*** Streamer Plugin v2.7.5.2 by Incognito loaded ***

[2015/04/01 00:17:42]   Loaded.
[2015/04/01 00:17:42]  Loading plugin: sscanf.so
[2015/04/01 00:17:42] 

[2015/04/01 00:17:42]  ===============================

[2015/04/01 00:17:42]       sscanf plugin loaded.     

[2015/04/01 00:17:42]          Version:  2.8.1        

[2015/04/01 00:17:42]    © 2012 Alex "******" Cole  

[2015/04/01 00:17:42]  ===============================

[2015/04/01 00:17:42]   Loaded.
[2015/04/01 00:17:42]  Loaded 3 plugins.

[2015/04/01 00:17:42] 
[2015/04/01 00:17:42] Filterscripts
[2015/04/01 00:17:42] ---------------
[2015/04/01 00:17:42]   Loaded 0 filterscripts.
This only happens on hosting. With any gamemode. What is the problem?

Sorry for my bad English!
Reply

Quote:
Originally Posted by GuyYahood1
Посмотреть сообщение
Why this public not calling?
I got the same problem that OnPlayerShootDynamicObject is not getting called.
Reply

I believe OnPlayerWeaponShot is called since they're player objects. Try this(untested):
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ) {

    if(IsPlayerConnected(playerid)) {
        if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT && IsValidDynamicObject(hitid)) {
       
            CallLocalFunction("OnPlayerShootDynamicObject", "ddfff", playerid, weaponid, fX, fY, fZ);
           
        }
    }
   
    CallLocalFunction("A_OnPlayerWeaponShot", "ddddfff", playerid, weaponid, hittype, hitid, fX, fY, fZ);
   
    if(funcidx("OnPlayerWeaponShot")) {
        return OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, fX, fY, fZ);
    }
   
    else return 1;
}

#if defined _ALS_OnPlayerWeaponShot
    #undef OnPlayerWeaponShot
#else
#define _ALS_OnPlayerWeaponShot
#endif

#define OnPlayerWeaponShot A_OnPlayerWeaponShot

forward A_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ);
Reply

The first part of this code won't work (or won't work properly), but this will.

pawn Код:
if(IsPlayerConnected(playerid))
{
    if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
    {
        new streamerid = Streamer_GetItemStreamerID(playerid, STREAMER_TYPE_OBJECT, hitid);
        if(IsValidDynamicObject(streamerid))
        {
            CallLocalFunction("OnPlayerShootDynamicObject", "dddfff", playerid, weaponid, streamerid, fX, fY, fZ);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 23 Guest(s)