Scripting help need strange request -
Edward d - 28.11.2012
hi guys i have left Gta and on a new game but i know some of you guys are thw best scripters arund and knew if any one could help it would be you guys. i have a jail script. here the issue in the game i can arrest and send ppl to jail but due the respawn command under the esc buttion players just respawn and walk free . also in the game you can have a stun gun muck like the gta and it works fine.( what i want to do is when someone is sent to jail he is stunded for like 3 mins real time ) ill try to pose the scripts here .
this is jail
[CODE][if (side player == WEST) exitwith {};
while {alive player} do
{
if ((player distance (getmarkerpos "cell")) <= 10) then
{
injail = true;
}
else
{
injail = false;
};
Sleep 0.5;
};
waitUntil {alive player};
if (alive player) then
{
if (injail) then
{
Sleep 30;
player setPos (getMarkerPos "cell");
}
else
{
};
};
[] execVM "D_Functions\jail.sqf";/CODE]
here is the stun and the stun gun scripts
Код:
_source = _this select 0;
_ammo = _this select 4;
_lease = 2;
if (_ammo in stun_bullet_array) then
{
_bullet = nearestObject [_source, _ammo];
while {!isNull _bullet} do
{
BPos = getPos _bullet;
Vel = velocity _bullet;
Direc = getDir _bullet;
deleteVehicle _bullet;
Sleep 0.01;
};
stun_bullet = _ammo createVehicle (BPos);
stun_bullet setDir (Direc);
while {!isNull stun_bullet} do
{
TPos = getPos stun_bullet;
targets_array = nearestObjects [TPos, ["Man"], 1.5];
target = targets_array select 0;
TDam = getDammage target;
deleteVehicle stun_bullet;
Sleep 0.01;
};
if (target animationPhase "AdthPercMstpSnonWnonDnon_3" >= 0.1) exitWith {};
if ((_source distance(getPos target)) <= 45) then
{
stunned = [_source, target];
publicVariable "stunned";
player groupChat format ["You stunned %1", target];
target switchMove "AdthPercMstpSnonWnonDnon_3";
target setDammage 0;
};
};
Код:
_target = _this select 0;
t_array = [];
t_array = [_target];
if (player == _target) then
{
disableUserInput true;
};
Sleep 10;
_tg = t_array select 0;
if (player == _tg) then
{
disableUserInput false;
player groupChat "You recovered. Use the 'Actions' >> 'Normal' menu to stand up.";
};
Код:
//Written By: DaChevs
//October 19, 2009
//Special Thanks to Peanut from OFPEC.com
private["_stunPlayer"];
_stunPlayer =
{
private ["_unit","_stunTime"];
_unit = _this select 0;
_stunTime = _this select 1;
if (local _unit) then
{
disableUserInput true;
sleep _stunTime;
disableUserInput false;
};
};
taserEffects =
{
private["_target","_source","_stunAnims","_stunAnim","_stunTime"];
_source=_this select 0;
_target=_this select 1;
_stunAnims =
[
"AdthPercMstpSnonWnonDnon_A1",
"AdthPercMstpSnonWnonDnon_A2",
"AdthPercMstpSnonWnonDnon_A3",
"AdthPercMstpSnonWnonDnon_A4",
"AdthPercMstpSnonWnonDnon_A5"
];
_stunAnim = _stunAnims select (ceil(random(count _stunAnims - 1)));
_stunTime = 10;
_target switchMove _stunAnim;
if (local _target) then
{
player groupChat "You were stunned";
[_target,_stunTime] spawn _stunPlayer;
};
if (local _source) then
{
player groupChat format ["You stunned %1!",_target];
};
sleep _stunTime;
_target switchMove "Normal";
};
trackTaser =
{
private["_source","_ammo","_bullet","_target"];
_source=_this select 0;
_ammo=_this select 4;
if (not(_ammo in stun_bullet_array)) exitWith {};
_bullet = nearestObject [_source,_ammo];
_target = cursorTarget;
deleteVehicle _bullet;
if (_source distance _target > 25) exitwith {};
[_source,_target] spawn taserEffects;
taserData=[_source,_target];
publicVariable "taserData";
};
Re: Scripting help need strange request -
Lz - 28.11.2012
I guess you could add this in to make them not move
pawn Код:
TogglePlayerControllable(playerid,0);//this will freeze player
SetTimerEx("Unfreeze",12000,false,playerid);//timer to call function Unfreeze(playerid) 12000 is time in miliseconds
}
forward Unfreeze(playerid);
public Unfreeze(playerid)
{
TogglePlayerControllable(playerid,1);//this will unfreeze player
}
Also use [ pawn ] tags makes it easier to read
Re: Scripting help need strange request -
GiamPy. - 29.11.2012
Use the worldboundaries function
Re: Scripting help need strange request -
Edward d - 04.12.2012
im sorry i dont know any scripting guys and dont even know what your talking about but i did make a trigger that when a player walks in to it it stuns them. BUT i dont know how to Awake them after the 1.5 stun timer is up. i used this part and it works for the stun .
if (player == player) then
{
disableUserInput true;
};
Sleep 1.5;
<<< need a wake up code here>>>>>