Editors Depot - Mission Editing and Scripting > Arma2 - Editing/Scripting Multiplayer
Multiplayer scripting
(1/1)
Samich:
Hey guys. Can someone help me please. Im making a kind of counterstrike style objective within a multiplayer mission but im struggling.
Basically the code below works perfectly for a single player in the editor but it falls to pieces quickly online, presumably because its running multiple scripts.
The code is quite long and i dont expect anyone to fix it for me but could someone please explain to me how im supposed to delegate out a script like this to the server and the clients because i've been staring at it for a few days now and im not getting anywhere at all :(
Thanks for any help
--- Code: ---if (isserver) then {
CS_bombbag addaction [("<t color=""#ED2744"">")+("Pickup Bomb"), "SAMpickupbomb.sqf", [], 1, false, true, "", "side player == east"];
CS_roundtime = 100;
CS_bombtimer = 10;
CS_bombdiffused = false;
CS_bombplanted = false;
cs_bombbag setpos [getmarkerpos "bomb_start" select 0, getmarkerpos "bomb_start" select 1, 0];
};
player setVariable ["cs_hasbomb",false,true];
player addmpEventHandler ["mpKilled", {_this execVM "SAMplayerkilled.sqf"}];
removebackpack player;
switch (side player) do
{
case west: {player setpos [getmarkerpos "start_west" select 0, getmarkerpos "start_west" select 1, 0]};
case east: {player setpos [getmarkerpos "start_east" select 0, getmarkerpos "start_east" select 1, 0]};
};
for [{}, {(cs_roundtime != 0) AND (!CS_bombplanted)}, {cs_roundtime = cs_roundtime - 1}] do
{
hint format["Time Remaining %1",cs_roundtime];
sleep 1;
};
if (cs_roundtime == 0) then {
titleText ["Blufor win!", "PLAIN"];
player setdamage 0;
sleep 3;
switch (side player) do
{
case west: {player setpos [getmarkerpos "respawn_west" select 0, getmarkerpos "respawn_west" select 1, 0]};
case east: {player setpos [getmarkerpos "respawn_east" select 0, getmarkerpos "respawn_east" select 1, 0]};
};
}
else
{
if (cs_bombplanted) then {
for [{}, {(cs_bombtimer != 0) AND (!CS_bombdiffused)}, {cs_bombtimer = cs_bombtimer - 1}] do
{
hint format["Bomb detonation in %1",cs_bombtimer];
sleep 1;
};
};
};
if (CS_bombdiffused) then {
titleText ["Blufor win!", "PLAIN"];
player setdamage 0;
sleep 6;
switch (side player) do
{
case west: {player setpos [getmarkerpos "respawn_west" select 0, getmarkerpos "respawn_west" select 1, 0]};
case east: {player setpos [getmarkerpos "respawn_east" select 0, getmarkerpos "respawn_east" select 1, 0]};
};
}
else
{
if (CS_bombtimer == 0) then {
"M_Mo_120mm_AT" createvehicle getpos cs_bombbag;
sleep 2;
player setdamage 0;
titleText ["Opfor win!", "PLAIN"];
sleep 5;
switch (side player) do
{
case west: {player setpos [getmarkerpos "respawn_west" select 0, getmarkerpos "respawn_west" select 1, 0]};
case east: {player setpos [getmarkerpos "respawn_east" select 0, getmarkerpos "respawn_east" select 1, 0]};
};
};
}
--- End code ---
Navigation
[0] Message Index
Go to full version