0 Members and 1 Guest are viewing this topic.
function arctan2(X, Y: single): single;begin if X < 0 then Result := arctan(Y/X) + Pi else if X > 0 then Result := arctan(Y/X) else if Y > 0 then Result := 1.5707 else Result := -1.5707;end;a:= arctan(X2-X1,Y2-Y1);
vX:= cos(a)*velocity;vY:= sin(a)*velocity;CreateBullet(TurretX,TurretY,vX,vY,Power,Style,ID);
CreateBullet function doesn't use any values from weapon mod, you need to manually specify bullet power (~10000 for sure kill). Also resulting damage will be effected by the speed of the bullet. So don't set speed to 0 if bullet is spawned just inside the player.
Code: [Select]function arctan2(X, Y: single): single;begin if X < 0 then Result := arctan(Y/X) + Pi else if X > 0 then Result := arctan(Y/X) else if Y > 0 then Result := 1.5707 else Result := -1.5707;end;
function arctan2(X, Y: single): single;begin if X < 0 then Result := arctan(Y/X) + Pi else if X > 0 then Result := arctan(Y/X) else if Y > 0 then Result := 1.5707 else Result := -1.5707;end;
Because Dodamage results in selfkill of target, like i said earlier, that is not what i wanted
thanks Gizd , im guessing the syntax is DoDamageBy(Target,Owner) ?also where did you get that function? it isnt on:http://enesce.com/help/ or http://devs.soldat.pl/wiki/index.php?title=Server_Scripting
also where did you get that function? it isnt on:http://enesce.com/help/ or http://devs.soldat.pl/wiki/index.php?title=Server_Scripting
NOTE: If you wish to be able to specify a player ID doing damage, use DoDamageBy: procedure DoDamageBy(ID,Shooter: Byte; Damage: Integer);
hmm ill have to stick with CreateBullet, DoDamageBy with 99 set as damage causes way worse lag than createbullet and actually continuosly causes the script to crash and the server to completely hang, hmm
nevermind, got CreateBullet to work fine, dont need DoDamageBy
if Weapon = 'Barrett M82A1' then begin for i := 1 to 32 do begin x := GetPlayerStat(Victim,'x'); y := GetPlayerStat(Victim,'y'); x2 := GetPlayerStat(i,'x'); y2 := GetPlayerStat(i,'y'); if RayCast(x,y,x2,y2,Dist,400) then begin if i <> Killer then begin if GetPlayerStat(i,'Alive') = true then begin //WriteLn(IDtoName(i)+' is in range of Raycast'); //CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, 0,-1000,100, 3, Killer); DoDamageBy(i, Killer, 99); BioKills[Killer]:=BioKills[Killer]+1; end; end; end; end; WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1); BioKills[Killer]:=BioKills[Killer]*0; end;
If player is close to wall it might change.
procedure AppOnIdle(Ticks: integer);vari: integer;Weapon: array[1..255] of array[1..32];beginfor i:= 1 to 32 do Weapon[GetPlayerStat(i, 'Primary')][i];end;end;//and then instead ofif Weapon = 'Barrett M82A1' then begin for i := 1 to 32 do //placefor i: 1 to 32 do if Weapon[8][i] then begin // or something like that. again, i would need to see the whole script
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.
Also, i cant remember that DoDamageBy exists, it isnt even in the scripting manual. :\Did you try DoDamage(i, Killer, 4000)
if Weapon = 'Barrett M82A1' then begin for i := 1 to 32 do begin x := GetPlayerStat(Victim,'x'); y := GetPlayerStat(Victim,'y'); x2 := GetPlayerStat(i,'x'); y2 := GetPlayerStat(i,'y'); if RayCast(x,y,x2,y2,Dist,400) then begin if i <> Killer then begin if GetPlayerStat(i,'Alive') = true then begin //WriteLn(IDtoName(i)+' is in range of Raycast'); CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, 0,-1000,100, 3, Killer); if getplayerstat(i,'Active') then DoDamageBy(i, Killer, 99); BioKills[Killer]:=BioKills[Killer]+1; end; end; end; end; WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1); BioKills[Killer]:=BioKills[Killer]*0; end;
if (...) then begin if (...) then begin end;end;
if ((...) AND (...)) OR (...) then beginend;
Procedure OnPlayerKill(Killer,Victim:Byte; Weapon:String);var X1,X2,Y1,Y2:Single i:Byte;begin if Weapon = 'Barrett M82A1' then begin GetPlayerXY(Victim,X,Y) for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) then begin GetPlayerXY(i,X2,Y2); if RayCast(X1,Y1,X2,Y2,Dist,400) AND (i <> Killer) AND (GetPlayerStat(i,'Alive') = true) then begin //WriteLn(IDtoName(i)+' is in range of Raycast'); CreateBullet(GetPlayerStat(i,'x'), GetPlayerStat(i,'y') - 0, 0,-1000,100, 3, Killer); DoDamageBy(i, Killer, 99); BioKills[Killer]:=BioKills[Killer]+1; end; end; WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1); BioKills[Killer] := 0; end;
Without trying to sound condescending, I think you should go learn assembly and then C++ to have a better understanding of how the computer works. You'll learn how to be much more efficient with programming concepts. In my opinion, people should learn in this order:1- physics2- chemistry3- electronic theory4- analog design5- logic design6- digital design7- microprocessors and assembly8- C++9- youdotherest
Quote from: zyxstand on July 14, 2010, 02:00:45 pmWithout trying to sound condescending, I think you should go learn assembly and then C++ to have a better understanding of how the computer works. You'll learn how to be much more efficient with programming concepts. In my opinion, people should learn in this order:1- physics2- chemistry3- electronic theory4- analog design5- logic design6- digital design7- microprocessors and assembly8- C++9- youdotherestyou forgot0- common sense
The server can crash when you choose a too high velocity.
It works, prolly it's because of some other script you use
also, if i use flames in CreateBullet, with No bullet Velocity, just 1 CreateBullet with flames lags the server to s**t
Procedure AppOnIdle(Ticks:Integer);var i,ii:Byte;begin if (Mine_Enabled = true) then CheckMines(); for i := 1 to HighestID() do if (GetPlayerStat(i,'Active') = true) then begin if (Player[i].Vanish) then if (Player[i].VanishTimer = 0) then RefreshVanish(i) else TimedVanish(i); if (Player[i].Rage) then if (Player[i].RageTimer = 0) then RefreshRage(i) else TimedRage(i); if (Player[i].Knife) AND (GetPlayerStat(i,'Primary') <> 14) then ForceWeapon(i,14,255,0); for ii := 1 to HighestID() do if (GetPlayerStat(ii,'Active') = true) AND (Player[i].Spy[ii]) then DrawSpyInterface(i,ii); end; end;