0 Members and 1 Guest are viewing this topic.
or make a custom function which calculates HighestID for you. You'll need to use it on player join/leave and on adding bots
HighestID:=Numplayers+Numbots;
PlayersActive := NumPlayers - Numbots
function HighestID: byte;begin for Result := 32 downto 1 do if GetPlayerStat(Result, 'Active') = true then break;end;
Function Setteam(ID,Team:Byte):String;beginCommand('/setteam'+Floattostr(Team)+' '+Floattostr(ID));end;function OnPlayerCommand(ID: Byte; Text: string): boolean;beginif Text = '/red' thenbegin Setteam(ID,1);end;end;
[8:11] syntax error
[...]what?
Procedure SetTeam(ID, Team: Byte); Begin Command('/setteam'+IntToStr(Team)+' '+IntToStr(ID));end;
Procedure SetTeam(ID, Team: Byte);begin Command('/setteam'+IntToStr(Team)+' '+IntToStr(ID));end;function OnPlayerCommand(ID: Byte; Text: string): boolean;beginif Text = '/red' thenbegin Setteam(ID,1);end;if Text = '/spec' thenbegin Setteam(ID,5);end;end;function OnCommand(ID: Byte; Text: string): boolean;beginif Text = '/blue' thenbegin Setteam(ID,2);end;if Text = '/green' thenbegin Setteam(ID,3);end;if Text = '/yellow' thenbegin Setteam(ID,4);end;end;
[...]tho if i use Command it errors with numbers if its in the script that why i have to use a function[...]
varCash,DEC,DECC,Botn,EBNN,EBNND,EBNNT,EDMM,EDMMT,EDMMD:Integer;BonusID,ID,EBN,EBNM,ED,EDM,DED,i:Byte;Command:String;deathexp,HC: Boolean;function HighestID: byte;begin for Result := 32 downto 1 do if GetPlayerStat(Result, 'Active') = true then break;end;
[9:2] unexpected end of file[9:2] syntax error
Function HighestID(): Byte; Var Dude: Byte; Begin For Dude := 32 DownTo 1 Do if GetPlayerStat(Dude,'Active') = True Then Break; Result := Dude;end;