Jump to content

[Workaround] Schwedes Map Marker (Client to Server)


SchwEde

Recommended Posts

================== Schwedes Map Marker UPDATE: 2015_04_01======================
 
UPDATE NOTES:
 
Now with multiple marker support and easier to call
 
Prologue
 
This Script was born through some support and should help people with infistar and scripts which create Map Markers on Clients. Also it can be used by scripter to get simple markers without adding each on individually.
I will not give much support for this, simply because i do not have much time to give support and this is for scripter/admins which know what they are doing.
The Installation wont be a step by step instruction on how to get everything prepared, you need to know where some files are and some scripting skills!
 
 
 
What it does?
 
This Script simply lets create the server a marker on the map through a clientsided script. This should be used by anyone who is using antihack (infistar) and a script which should create a marker clientsided (like carepackages)
 
What you need:
 
public_EH.sqf
compiles.sqf
server_functions.sqf
your Script where the marker should be created
 
 
Instructions:
 
Step 1:
 
compiles.sqf
 
Place this in the !isDedicated Section

	Schwedes_CreateMarker =			compile preprocessFileLineNumbers "dayz_code\compile\schwedes_createmarker.sqf";	//Schwedes create Marker

Safe and Done
 
Step 2:
 
public_EH.sqf
 
Add this:

	//Schwedes Marker
	"PVDZE_SchwedesMarker"		addPublicVariableEventHandler {(_this select 1) spawn Schwedes_ServerMarker};
	"PVDZE_SchwedesMarkerRemove"		addPublicVariableEventHandler {(_this select 1) spawn Schwedes_ServerMarkerRemove};

in the isServer section [A Section is allways something between {...input...};]
 
Safe it and place it somewhere in your mission
 
 
Step 3
 
init.sqf
 
redirect the public_EH.sqf to your custom one
 
Safe and Done
 
Step 4
 
server_functions.sqf
 
Place this somewhere near the bottom:
 
http://pastebin.com/2Rx03bNw
 
Safe it and place it in your dayz_server.pbo
 
Step 5
 
create a new sqf and name it schwedes_createmarker
 
put this know at the point you want to create the marker

/*//////////////////////////
Schwedes Marker
 
How to call:
 
[_unit,_markername,_text,_type,_brush,_sizeX,_sizeY,_color] spawn Schwedes_CreateMarker;
 
Example 2 for a Shape
[player,"MyMarkerName","DisplayTextonMap","RECTANGLE","Grid",50,100,"ColorGreen"] spawn Schwedes_CreateMarker;
 
Example 1 for a cfgMarker (width and hight does not matter on cfgMarkers so just set to 0)
[_box,"MyOtherMarkerName","Location Box","Flag","Solid",0,0,ColorOrange] spawn Schwedes_CreateMarker
 
/-----------------------/
 
How to Remove:
 
Put this in your Code where you called it from
PVDZE_SchedesMarkerRemove = [_uniqueName,_markertext];
publicVariableServer "PVDZE_SchwedesMarkerRemove";
 
*///////////////////////////
private ["_unit","_markername","_getPos","_text","_type","_brush","_sizeX","_sizeY","_color","_uniqueName","_markertext"];
 
//Getting the Variables
_unit =  _this select 0; 
_markername =   _this select 1;
_text =         _this select 2;
_type =         _this select 3; //Possible Values: "ICON", "RECTANGLE", "ELLIPSE" << or >> [url=https://community.bistudio.com/wiki/cfgMarkers]https://community.bistudio.com/wiki/cfgMarkers[/url]
 
//Only change this Values if using: "ICON", "RECTANGLE", "ELLIPSE" as a type
_brush =  _this select 4;
_sizeX =        _this select 5; //Needs to be a Number
_sizeY =        _this select 6; //Needs to be a Nubmer
_color =        _this select 7; //Possible Values: "Default", "ColorBlack", "ColorGrey", "ColorRed", "ColorGreen", "ColorBlue", "ColorYellow", "ColorOrange", "ColorWhite", "ColorPink", "ColorBrown", "ColorKhaki", "ColorWEST", "ColorEAST", "ColorGUER", "ColorCIV", "ColorUNKNOWN", "Color1_FD_F" (Light red), "Color2_FD_F" (Light khaki), "Color3_FD_F" (Light orange), "Color4_FD_F" (Light blue)
 
//Making them Unique
if (isPlayer _unit) then {
_playerUID = getPlayerUID _unit;
_uniqueName = _markername + _playerUID;
} else { 
_ObjectID = _unit getvariable ['CharacterID','0']; //May change for CharacterID for another Variable you have set to the Object e.g. Mission, Sarge, etc.
_uniqueName = _markername + _ObjectID;
};
 

//get Position of _unit
if !(typeName _unit == "ARRAY") then {
_getPos =       getPos _unit;
} else {
_getPos = _unit;
}; 
  //Unique Name for Markers type "ICON", "RECTANGLE", "ELLIPSE" _markertext = _uniqueName + "_shapeText";   PVDZE_SchwedesMarker = [_uniqueName,_getPos,_text,_type,_brush,_sizeX,_sizeY,_color,_markertext]; publicVariableServer "PVDZE_SchwedesMarker";   /*  you also could set a Condition with a global variable or something to delete the marker   waitUntil { GloabalVariable_Condition };   PVDZE_SchedesMarkerRemove = [_uniqueName,_markertext]; publicVariableServer "PVDZE_SchedesMarkerRemove";   */  

 STEP 6
Security Changes:
You may want to rename the PVDZE_Schwede variables to something unique, so hackers cant exploit this to create marker all over the map  :)

 

Battleye Filters: 

You will need to edit your publicVariable.txt to prevent kicks from using this Script!

 

 Simply add 

!="PVDZE_SchwedesMarker", !="PVDZE_SchwedesMarkerRemove"

to the Filter

5 "PVDZE_" 

If you still get kicked, try it yourself with this very good tut from ebay: BE-Filders

 
HOW TO USE:
 
You can find examples in schwedes_createmarker,sqf at the Top in the Comment Section
 
 
and this at the point where it should delete the marker:


PVDZE_SchwedesMarkerRemove = [_markername];
publicVariableServer "PVDZE_SchwedesMarkerRemove";

or use a condition in schwedes_createmarker example in in there.
 
Done.
 
Tested and worked :)
 
 
Credits:
 
DangerRuss
infiSTAR
UKMartin

Link to comment
Share on other sites

if you are using antihack (infistar) and you execute a cliented sided script where he should create a marker, the player will get kicked (and maybe banned).

This script is sending the part with creating the marker over to the server, so the server is creating the marker and the rest is still client sided, this way the player wont get kicked/banned

Link to comment
Share on other sites

i dont get the point of this either, the player will be executing cratemarker either way, and you still need to edit antihack/befilters to make it possible ... tbh this feels like you take the difficult road to the finish when there is plenty of shortcuts availible.

 

... also all players on the server will see these markers, you cant make them local to the player without using createmarkerlocal

Link to comment
Share on other sites

Well maybe I need to give ou guys a little more of a background story then on this:

In this thread I helped Danger Russ on his issue with the carepakages script
and this was my way to fix it.
So I made a release threads for people struggling with the same problem :)

Link to comment
Share on other sites

Well maybe I need to give ou guys a little more of a background story than on this:

In this thread I helped Danger Russ on his issue with the carepakages script

and this was my way to fix it.

So I made a release threads for people struggling with the same problem :)

 

Well first off all, it's amazing how much time you'd have spend to help that guy out, i really appreaciate that and you should keep that up!

Second. CreateMarker is global, it want's a caller, that has to be a String.. So in that script i can see the error immediatly: "

_null = createMarker ["MarkerDrop",_positionB];" - "_null" is not a String, which is why this will never work. See the arma2 script reference.

If he would call the marker from a string, i would do it from _unit (which is the player in his script) and set's the position correctly (positionM is an array) for example like so:

 

_unit = createMarker ["MarkerDrop",[_getPos select 0, _getPos select 1]];

 

it should work fine :)

 

//EDIT: I still like your script tho, as it's a "fast" way to create markers.. So thanks for that :)

Link to comment
Share on other sites

it worked as i tested it with 2 players, both could create and both markers where visible, but i think you are right, this could cause some unnecessary problems, thanks for that =)

But i do not know for sure if i can use _unit without letting infistar get in action there and kick the player again ^^

 

i will test this version here:

_position = [_getPos select 0, _getPos select 1];

deleteMarker _markername;
_schwedesmarker  = createMarker [_markername,_position];
_schwedesmarker  setMarkerText _text;
if (_type in ["ICON", "RECTANGLE", "ELLIPSE"]) then {
	_schwedesmarker setMarkerShape _type;
	_schwedesmarker  setMarkerSize [_sizeX,_sizeY];
} else {
	_schwedesmarker  setMarkerType _type;
};
_schwedesmarker  setMarkerColor _color;

};

Schwedes_ServerMarkerRemove = {
_markername =     _this select 0;

deleteMarker _markername;
};
Link to comment
Share on other sites

Since you're in to this marker thing, you mind helping me? If a player double clicks the map, it creates a marker and you can give it a name. Now somebody just posted the file, in which that happens, so i want to change it - if you type a marker Type in the box, it will delete the normal marker and create a new marker with that type.

Would be nice, if you spare me some work ;D

I need a function, that creates the marker with the given text, if the type is in the name..

Parameters should be:
_display = _this select 0;
_type = _this select 1;
_text = _this select 2;

Link to comment
Share on other sites

Well first off all, it's amazing how much time you'd have spend to help that guy out, i really appreaciate that and you should keep that up!

Second. CreateMarker is global, it want's a caller, that has to be a String.. So in that script i can see the error immediatly: "

_null = createMarker ["MarkerDrop",_positionB];" - "_null" is not a String, which is why this will never work. See the arma2 script reference.

If he would call the marker from a string, i would do it from _unit (which is the player in his script) and set's the position correctly (positionM is an array) for example like so:

 

_unit = createMarker ["MarkerDrop",[_getPos select 0, _getPos select 1]];

 

it should work fine :)

 

//EDIT: I still like your script tho, as it's a "fast" way to create markers.. So thanks for that :)

To be clear, the original carepackage script I was using works just fine.. only the antihack completely blocks it from running when a non admin tries to call in the carepackage because it won't allow the player to create the marker. Turn the antihack off, or an admin does it, worked fine.

Link to comment
Share on other sites

It would be nice, if i can set my own position..

 

[player,"MyMarkerName","DisplayTextonMap","RECTANGLE","Grid",50,100,"ColorGreen",PosX,PosY] spawn Schwedes_CreateMarker;

OR
 

[player,"MyMarkerName","DisplayTextonMap","RECTANGLE","Grid",50,100,"ColorGreen",PosXY] spawn Schwedes_CreateMarker;

Maybe by checking the length of "_this" ?

 

//Pseudo Code! 

if ((count _this) == 8) then {
PosX = (_this select 8) select 0 ;
PosY = (_this select 8) select 1 ; 
};

if ((count _this) == 9) then {
PosX = _this select 8;
PosY = _this select 9;
};
Link to comment
Share on other sites

you can:

 

instead of geting the position of player/box or what every

 

you could just add this:

[[x,y],"MyMarkerName","DisplayTextonMap","RECTANGLE","Grid",50,100,"ColorGreen",PosXY] spawn Schwedes_CreateMarker;

but i did not implement a function for this in the script.

Will update it right away :)

 

EDIT:

in schwedes_createmarker
Replace:

_getPos =       getPos _unit;

with this:

//get Position of _unit
if !(typeName _unit == "ARRAY") then {
_getPos =       getPos _unit;
} else {
_getPos = _unit;
}; 

This check way it should work with exact position you write in there

 

Post #1 Updated!

 

EDIT: needed typeName before _unit to get it working!

Link to comment
Share on other sites

//get Position of _unit
if (_unit == "ARRAY") then {
_getPos =       getPos _unit;
} else {
_getPos = _unit;
}; 

 

lol, SchwEde .... this will always return true as both are arrays, count the arrays as martin propsed instead and check if there is more than one

 

... either way i still think it would be easier to edit the antihack and just allow the client to create the marker instead of all this.

Link to comment
Share on other sites

Nope I'm checing there if _this select 0 is an array and not the whole thing :)

 

Well maybe you are right and it is, but i already wrote this thing and other scripter may want to use it to marker the easy way isntead of adding and remove them individually ^^

 

I just gave an option for people, nothing more :)

 

EDIT:

 

Also i'm not a big fan of changing something in the AH.sqf, simply because you may open some gates for script kiddies.

This method a hacker needs to write something exact for your server to use it right, both ways are exploitable, but if you rename the variables you defently has some more security then disable the marker check in ah.sqf, at least this is my opinion on that ^^

 

Tested with:

_array = [["abc","abcd","abcde"],"abcdefg","abcdefgh","abcdefgijklm"];
_isArray = typeName _itemsFood == "ARRAY";
systemChat format['%1',_isArray];

result = true

 

_array = [["abc","abcd","abcde"],"abcdefg","abcdefgh","abcdefgijklm"];
_isArray = typeName (_array select 1) == "ARRAY";
systemChat format['%1',_isArray];

result = false

 

_array = [["abc","abcd","abcde"],"abcdefg","abcdefgh","abcdefgijklm"];
_isArray = typeName (_array select 0) == "ARRAY";
systemChat format['%1',_isArray];

result = true

 

so this part is right :)

Link to comment
Share on other sites

 

Nope I'm checing there if _this select 0 is an array and not the whole thing :)

 

Well maybe you are right and it is, but i already wrote this thing and other scripter may want to use it to marker the easy way isntead of adding and remove them individually ^^

 

I just gave an option for people, nothing more :)

 

EDIT:

 

Also i'm not a big fan of changing something in the AH.sqf, simply because you may open some gates for script kiddies.

This method a hacker needs to write something exact for your server to use it right, both ways are exploitable, but if you rename the variables you defently has some more security then disable the marker check in ah.sqf, at least this is my opinion on that ^^

 

Tested with:

_array = [["abc","abcd","abcde"],"abcdefg","abcdefgh","abcdefgijklm"];
_isArray = typeName _itemsFood == "ARRAY";
systemChat format['%1',_isArray];

result = true

 

_array = [["abc","abcd","abcde"],"abcdefg","abcdefgh","abcdefgijklm"];
_isArray = typeName (_array select 1) == "ARRAY";
systemChat format['%1',_isArray];

result = false

 

_array = [["abc","abcd","abcde"],"abcdefg","abcdefgh","abcdefgijklm"];
_isArray = typeName (_array select 0) == "ARRAY";
systemChat format['%1',_isArray];

result = true

 

so this part is right :)

 

It's definitely a nice option to have. Unfortunately it does NOT play nicely with battleye at all so people need to be prepared for this!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...