Jump to content
Sign in to follow this  
uncreatedlemon

Issues with MP Scripting. Calling a sqf to other player

Recommended Posts

Hey all, 

 

Having a little bit of an issue with a script i'm trying to make, purpose is for an officer to be able to open up a dialog that the player he's looking at can interact with. I can get it to work for when it's locally hosted on my pc, but not on my dedicated server...does anyone have any particular ideas why this may be?

 

//setting the variables...
_playerid = getPlayerUID Player;
_Lemon = ["myidishere"]; //Lemon
_OfficerRanks = ["Second Lieutenant","First Lieutenant","Captain","Major","Colonel"];
_getRank = ProfileNameSpace getVariable "playerRank";

	
if (_playerid in _Lemon) then {
	ProfileNameSpace setVariable ["playerRank","Colonel"];
	Player setRank "Colonel";
	ProfileNameSpace setVariable ["PlayerFaction","US Army"];
	saveProfileNameSpace;
	SystemChat "Welcome back Colonel";
};

if (_getRank in _OfficerRanks) then {
	player addAction ["Faction Chooser",{Recruit = cursorObject;["Join_Faction","CreateDialog","Recruit"] Call BIS_fnc_MP;},"",0,false,false,"",'(alive player) AND (cursorObject isKindOf "Man") AND (alive cursorObject) AND (player distance cursorObject < 2) AND !dialog'];
	player addAction ["Demote Soldier",{Soldier = cursorObject;["Demotion.sqf","BIS_fnc_execVM","Soldier"] Call BIS_fnc_MP;},"",0,false,false,"",'(alive player) AND (cursorObject isKindOf "Man") AND (alive cursorObject) AND (player distance cursorObject < 2) AND !dialog'];
	player addAction ["Promote Soldier",{Soldier = cursorObject;["Promotion.sqf","BIS_fnc_execVM","Soldier"] Call BIS_fnc_MP;},"",0,false,false,"",'(alive player) AND (cursorObject isKindOf "Man") AND (alive cursorObject) AND (player distance cursorObject < 2) AND !dialog'];
};

 

Share this post


Link to post
Share on other sites

No idea.

What faulty behaviour are you seeing on a dedicated server? Details! 

How are you executing what you provided so far?

What are the contents of the scripts being called clientside?

Share this post


Link to post
Share on other sites

mybad, wasn't sure what was needed;

 

faulty behaviour: Whilst the addaction shows for the officer, nothing is happening to the target client (should open dialog or give a hint message, neither happen). On non dedicated environment, this works fine.

Executing Method: we have tried it by executing it in "initPlayerLocal.sqf" and "initPlayerServer.sqf". 

Contents of scripts: 

 

Demotion.sqf

Spoiler

_getRank = profileNameSpace getVariable "playerRank";
_getFaction = ProfileNameSpace getVariable "playerFaction";

//Promoting the soldier we are looking at
if (_getFaction == "US Army") then {
ArmyRankID = ArmyRankID - 1;
execVM "CheckRank.sqf";
hint Format ["You were demoted to %1!",ArmyRank];
ProfileNameSpace setVariable ["playerRank",ArmyRank];
SaveProfileNamespace;
};

if (_getFaction == "US Aviation") then {
AirRankID = AirRankID - 1;
execVM "CheckRank.sqf";
hint Format ["You were demoted to %1!",AirRank];
ProfileNameSpace setVariable ["playerRank",AirRank];
SaveProfileNamespace;
};

if (_getFaction == "US Marine Corps") then {
MarineRankID = MarineRankID - 1;
execVM "CheckRank.sqf";
hint Format ["You were demoted to %1!",MarineRank];
ProfileNameSpace setVariable ["playerRank",MarineRank];
SaveProfileNamespace;
};
 

 

Promotion.sqf

Spoiler

_getRank = profileNameSpace getVariable "playerRank";
_getFaction = ProfileNameSpace getVariable "playerFaction";

// Promoting the soldier we are looking at
if (_getFaction == "US Army") then {
    ArmyRankID = ArmyRankID + 1;
    execVM "CheckRank.sqf";
    hint Format ["Congratulations on your promotion to %1",ArmyRank];
    ProfileNameSpace setVariable ["playerRank",ArmyRank];
    SaveProfileNamespace;
};

if (_getFaction == "US Aviation") then {
    AirRankID = AirRankID + 1;
    execVM "CheckRank.sqf";
    hint Format ["Congratulations on your promotion to %1",AirRank];
    ProfileNameSpace setVariable ["playerRank",AirRank];
    SaveProfileNamespace;
};

if (_getFaction == "US Marine Corps") then {
    MarineRankID = MarineRankID + 1;
    execVM "CheckRank.sqf";
    hint Format ["Congratulations on your promotion to %1",MarineRank];
    ProfileNameSpace setVariable ["playerRank",MarineRank];
    SaveProfileNamespace;
};

 

CheckRank.sqf (Rank structure for the mission/server)

Spoiler

Switch (true) do{
    case (ArmyRankID == 0):
        {
            ArmyRank = "Private E1";
        };
    case (ArmyRankID == 1):
        {
            ArmyRank = "Private E2";
        };
    case (ArmyRankID == 2):
        {
            ArmyRank = "Private First Class";
        };
    case (ArmyRankID == 3):
        {
            ArmyRank = "Corporal";
            Soldier setRank "Corporal";
        };
    case (ArmyRankID == 4):
        {
            ArmyRank = "Sergeant";
        };
    case (ArmyRankID == 5):
        {
            ArmyRank = "Staff Sergeant";
            Soldier setRank "SERGEANT";
        };
    case (ArmyRankID == 6):
        {
            ArmyRank = "Sergeant First Class";
        };
    case (ArmyRankID == 7):
        {
            ArmyRank = "Master Sergeant";
        };
    case (ArmyRankID == 8):
        {
            ArmyRank = "Sergeant Major";
        };
    case (ArmyRankID == 9):
        {
            ArmyRank = "Second Lieutenant";
            Soldier setRank "LIEUTENANT";
        };
    case (ArmyRankID == 10):
        {
            ArmyRank = "First Lieutenant";
        };
    case (ArmyRankID == 11):
        {
            ArmyRank = "Captain";
            Soldier setRank "CAPTAIN";
        };
    case (ArmyRankID == 12):
        {
            ArmyRank = "Major";
            Soldier setRank "MAJOR";
        };
    case (ArmyRankID == 13):
        {
            ArmyRank = "Colonel";
            Soldier setRank "COLONEL";
        };
};

Switch (true) do{
    case (AirRankID == 0):
        {
            AirRank = "Airman Basic";
        };
    case (AirRankID == 1):
        {
            AirRank = "Airman";
        };
    case (AirRankID == 2):
        {
            AirRank = "Airman First Class";
        };
    case (AirRankID == 3):
        {
            AirRank = "Senior Airman";
            Soldier setRank "Corporal";
        };
    case (AirRankID == 4):
        {
            AirRank = "Staff Sergeant";
        };
    case (AirRankID == 5):
        {
            AirRank = "Technical Sergeant";
            Soldier setRank "SERGEANT";
        };
    case (AirRankID == 6):
        {
            AirRank = "Master Sergeant";
        };
    case (AirRankID == 7):
        {
            AirRank = "Senior Master Sergeant";
        };
    case (AirRankID == 8):
        {
            AirRank = "Chief Master Sergeant";
        };
    case (AirRankID == 9):
        {
            AirRank = "Second Lieutenant";
            Soldier setRank "LIEUTENANT";
        };
    case (AirRankID == 10):
        {
            AirRank = "First Lieutenant";
        };
    case (AirRankID == 11):
        {
            AirRank = "Captain";
            Soldier setRank "CAPTAIN";
        };
    case (AirRankID == 12):
        {
            AirRank = "Major";
            Soldier setRank "MAJOR";
        };
    case (AirRankID == 13):
        {
            AirRank = "Colonel";
            Soldier setRank "COLONEL";
        };
};

Switch (true) do{
    case (MarineRankID == 0):
        {
            MarineRank = "Private";
        };
    case (MarineRankID == 1):
        {
            MarineRank = "Private First Class";
        };
    case (MarineRankID == 2):
        {
            MarineRank = "Lance Corporal";
        };
    case (MarineRankID == 3):
        {
            MarineRank = "Corporal";
            Soldier setRank "Corporal";
        };
    case (MarineRankID == 4):
        {
            MarineRank = "Sergeant";
        };
    case (MarineRankID == 5):
        {
            MarineRank = "Staff Sergeant";
            Soldier setRank "SERGEANT";
        };
    case (MarineRankID == 6):
        {
            MarineRank = "Gunnery Sergeant";
        };
    case (MarineRankID == 7):
        {
            MarineRank = "Master Sergeant";
        };
    case (MarineRankID == 8):
        {
            MarineRank = "Sergeant Major";
        };
    case (MarineRankID == 9):
        {
            MarineRank = "Second Lieutenant";
            Soldier setRank "LIEUTENANT";
        };
    case (MarineRankID == 10):
        {
            MarineRank = "First Lieutenant";
        };
    case (MarineRankID == 11):
        {
            MarineRank = "Captain";
            Soldier setRank "CAPTAIN";
        };
    case (MarineRankID == 12):
        {
            MarineRank = "Major";
            Soldier setRank "MAJOR";
        };
    case (MarineRankID == 13):
        {
            MarineRank = "Colonel";
            Soldier setRank "COLONEL";
        };
};

 

Share this post


Link to post
Share on other sites

I saw that page about remoteExec, i'll be honest, it's completely confusing me. Any possibility of an example would be amazing, if not i'll continue playing around with it! Appreciate the response btw

 

edit: Gonna give this a try ; "Join_Faction" remoteExec ["CreateDialog","Recruit"];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×