0 Members and 1 Guest are viewing this topic.
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);beginif Weapon = 'Chainsaw' 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,300000) 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, 0,100, 4, Killer); BioKills:=BioKills+1; end; end; end; end; WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills),$EE81FAA1); BioKills:=0; //if Victim <> Killer then if IDtoName(Killer) = 'Mr.Zombie' then if Weapon = 'Chainsaw' then WriteConsole(0,IDtoName(Victim)+' has just screwed up, Lookout!',$EEFA0002); end; end;
//Script Help to Frosty//By Squiddy ~Var PosX, PosY: Array[1..32] of Single;BioKills: Array[1..32] of Integer;Procedure OnPlayerKill(Killer, Victim: Byte; Weapon: String); Var F: Byte; Dist: Single; Begin For F := 1 To 32 Do if GetPlayerStat(F,'Active') = True Then Begin if GetPlayerStat(Killer,'Primary') = 15 Then Begin PosX[Killer] := GetPlayerStat(Killer,'X'); PosY[Killer] := GetPlayerStat(Killer,'Y'); PosX[F] := GetPlayerStat(F,'X'); PosY[F] := GetPlayerStat(F,'Y'); if F <> Killer Then Begin if RayCast(PosX[Killer],PosY[Killer],PosX[F],PosY[F],Dist,30000) = True Then Begin CreateBullet(PosX[F],PosY[F],0,0,150,4,Killer); BioKills[Killer] := BioKills[Killer] + 1; end; end; end; end;end;
WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]),$EE81FAA1);
if GetPlayerStat(Killer,'Primary') = 15 Then Begin PosX[Killer] := GetPlayerStat(Killer,'X'); PosY[Killer] := GetPlayerStat(Killer,'Y'); PosX[F] := GetPlayerStat(F,'X'); PosY[F] := GetPlayerStat(F,'Y'); if F <> Killer Then Begin if RayCast(PosX[Killer],PosY[Killer],PosX[F],PosY[F],Dist,30000) = True Then Begin CreateBullet(PosX[F],PosY[F],0,0,150,4,Killer); BioKills[Killer] := BioKills[Killer] + 1; if Victim <> Killer then if IDtoName(Killer) = 'Mr.Zombie' then if GetPlayerStat(Killer,'Primary') = 15 Then WriteConsole(0,IDtoName(Victim)+' has just fucked up, Lookout!',$EEFA0002); end; end; end;
Seems like something was wrong with the file, I deleted some blank spaces and it worked, don't ask why.
WriteConsole(Killer,'Bio-Kills: '+Inttostr(BioKills[Killer]+'!'),$EE81FAA1);
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.
holy crap is it that simple?? :Othanks swompie From: May 08, 2010, 05:49:42 amhmm having some troublesemicolon expected on line 12
Var Kills: Array[1..32] of Integer;Procedure OnPlayerKill(Killer, Victim: Byte; Weapon: String); Begin if Killer <> Victim Then Kills[Killer] := Kills[Killer] + 1; end;//Didn't get the rest of the Script..
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);begin//stuffif Player[Killer] = Player[Victim] then begin//stuffend;end;
if Player[Killer] = Player[Victim] then writeconsole(Victim,'your kill streak: '+inttostr(Kills[Victim]),$FFEO2OFE)
also, kills would be alot more than 32, or is that just storing the values for all 32 ppl? i am still a tiny bit confused about the arrays
Var Kills: Array[1..32] of Integer;Procedure OnPlayerKill(); Begin if Killer <> Victim Then Begin //Checks if killer is different from victim Kills[Killer] := Kills[Killer] + 1; //Increasing by one Killer's Kills. WriteConsole(Killer,'Your Kill Streak: '+IntToStr(Kills[Killer]),$FFFFFF); end else WriteConsole(ID,'You cant get kills by killing yourself!',$FFFFFF);end;//That should do it.//Arrays store data for [Min..Max] values you put in.//Like, go:Procedure OnPlayerSpeak(); Begin if Text = '!mykills' Then WriteConsole(ID,'Your kills: '+IntToStr(Kills[ID]),$FFFFFF);end;//See?//This \/{Var Kills: Integer;}//That /\ is a global var. It's unique for every player in the server.//If, for instance, you go "Kills := 0;", then every player's kills streak will be reseted.//Doing "Kills[ID] := 0;" would only reset one player's kills streak//Hope you've learned :)//Any more questions, feel free to ask :D
type // start type TPlayer = Record // name of the type Kills: integer; Anoter_Variable: byte; end; // declares the end of the TPlayer type.var Player: Array [1..32] of TPlayer; // next you need to declare it as an variable.//Looks like that when you use it: Player[ID].Variableprocedure OnPlayerKill(Killer, Victim: byte; Weapon: string);begin if Killer <> Victim then begin Player[Killer].Kills := Player[Killer] + 1; WriteConsole(ID, 'Kill streak: ' + inttostr(Player[Killer].Kills), $FFFFFF); end; Player[Victim].Kills := 0;end;
thanks swompie, see dnmr? no one else has any problem, if you post anything like that again ima just ignore it
so using a single tab for each indent is bad? if i use spaces then notepad++ doesnt show me the indent guide(the lines going from the begins to the ends) and using spaces somehow corrupts the script i had to use tabs as indent just to fix up one of my scripts so idk what to do
If you want Notepad++ to use two spaces instead of a real tab whenever you press the tab button, do the following:[...]
procedure OnMapChange(NewMap: string);begin For i := 1 to 32 do begin GiveBonus(i, BonusID); if GetPlayerStat(i,'Team') = 1 then begin Cash:=Cash+GetPlayerStat(i,'Kills'); WriteConsole(i,'Match Bonus, congrats you have earned your team: '+GetPlayerStat(i,'Kills')+' bonus cash for kills this match',$EE81FAA1); end; end;end;
var HBFT:Array[1..32] of Boolean;function OnPlayerCommand(ID: Byte; Text: string): boolean;begin if Text = '/buy FTP' then begin if Cash < 10000 then begin WriteConsole(0,IdtoName(ID)+' just tried to purchase a Flag Teleport, not enough funds!',$EE81FAA1); end; if Cash >= 10000 then begin Cash :=Cash-10000; WriteConsole(0,IdtoName(ID)+' has just bought a Flag Teleport for 10000 Cash',$EE81FAA1); HBFT[ID]:=True; end; end;end;procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);begin if HBFT[ID] = True then begin MovePlayer(ID,GetObjectStat(1,'X'), GetObjectStat(1, 'Y')); WriteConsole(ID,'Grab detected, moving you now...',$EE81FAA1); HBFT[ID]:=False; end;end;
The object styles of alpha/bravo flags should be 1 and 2 iirc.
i:=KillObject(2);SetSpawnStat(i,'x',GetPlayerStat(ID,'x'));SetSpawnStat(i,'y',GetPlayerStat(ID,'y'));
varTSec,Tmin,BTSec,BTMin:Array[1..32] of Integer;TA:Array[1..32] of Boolean;procedure AppOnIdle(Ticks: integer);begin for i:= 1 to 32 do begin if GetPlayerStat(i,'human') = true then if GetPlayerStat(i,'Alive') = true then TA[i]:= True; if TA[i] = True then begin TSec[i]:=TSec[i]+1; if TSec[i] = 60 then begin TMin[i]:= TMin[i]+1; TSec[i]:= 0; end; end; if GetPlayerStat(i,'human') = true then if GetPlayerStat(i,'Alive') = False then TA[i]:= False; If TA[i] = False then begin BTSec[i]:=TSec[i]; TSec[i]:=0; if TMin[i]>BTMin[i] then BTMin[i]:=TMin[i]; TMin[i]:=0; end; end;end;
WriteConsole(i,'Longest Time Survived: '+inttostr(BTMin[i])+':'+inttostr(BTSec[i])+' (M:S)!',$EE81FAA1);
const ClBad = $FFFF44;Type Stats = Record LongTime: Boolean; TSec,Tmin,BTSec,BTMin: Integer; end; var Player: Array[1..32] of Stats; LongestTime: Array[1..2] of Integer;Procedure ResetStats(ID:Byte); begin Player[ID].LongTime := false; end; Procedure CheckTime(ID:Byte); begin if Player[ID].BTMin > LongestTime[1] then begin LongestTime[1] := Player[ID].BTMin; LongestTime[2] := Player[ID].BTSec; Player[ID].LongTime := true; end else begin if Player[ID].BTMin = LongestTime[1] then if Player[ID].BTSec > LongestTime[2] then begin LongestTime[1] := Player[ID].BTMin; LongestTime[2] := Player[ID].BTSec; Player[ID].LongTime := true; end; end; end; Procedure OnJoinGame(ID,Team:Byte); begin ResetStats(ID); end; Procedure AppOnIdle(Ticks: integer);var i:Byte; begin for i:= 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Alive') = true) then begin if GetPlayerStat(i,'Human') = true then begin TSec[i]:= TSec[i]+1; if TSec[i] = 60 then begin TMin[i]:= TMin[i]+1; TSec[i]:= 0; end; end else begin BTSec[i]:=TSec[i]; TSec[i]:=0; if TMin[i] <> 0 then BTMin[i]:=TMin[i]; TMin[i]:=0; CheckTime(i); end; end; end;
const ClBad = $FFFF44; ClGood = $EE00FF; Type Stats = Record LongTime: Boolean; TSec,Tmin,BTSec,BTMin: Integer;end; var Player: Array[1..32] of Stats; LongestTime: Array[1..2] of Integer;Procedure ResetStats(ID:Byte); begin Player[ID].LongTime := false; end; Procedure CheckTime(ID:Byte); begin if Player[ID].BTMin > LongestTime[1] then begin LongestTime[1] := Player[ID].BTMin; LongestTime[2] := Player[ID].BTSec; Player[ID].LongTime := true; WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood); end else begin if Player[ID].BTMin = LongestTime[1] then if Player[ID].BTSec > LongestTime[2] then begin LongestTime[1] := Player[ID].BTMin; LongestTime[2] := Player[ID].BTSec; Player[ID].LongTime := true; WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood); end; end; end; Procedure OnJoinGame(ID,Team:Byte); begin ResetStats(ID); end; Procedure AppOnIdle(Ticks: integer);var i:Byte; begin for i:= 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Alive') = true) then begin if GetPlayerStat(i,'Human') = true then begin TSec[i]:= TSec[i] + 1; if TSec[i] = 60 then begin TMin[i]:= TMin[i] + 1; TSec[i]:= 0; end; end else begin if TSec[i] > 0 then BTSec[i] := TSec[i]; TSec[i] := 0; if TMin[i] > 0 then BTMin[i]:= TMin[i]; TMin[i] := 0; CheckTime(i); end; end; end;