0 Members and 1 Guest are viewing this topic.
procedure OnPlayerSpeak(ID: Byte; Text: string);var var1,var2,var3:single; switch:string;begincase switch of'!help': begin SayToPlayer (ID, 'Available commands:'); SayToPlayer (ID, '!time'); SayToPlayer (ID, '!stats'); end'!time': WriteConsole (0, 'Current Server time is '+FormatDate('hh:nn:ss am/pm'), $0000FF);'!stats': begin if (GetPlayerStat(ID,'Deaths') > 0) then begin SayToPlayer (ID, 'Score : '+inttostr(GetPlayerStat(ID,'Kills'))); SayToPlayer (ID, 'Deaths : '+inttostr(GetPlayerStat(ID,'Deaths'))); var1 := GetPlayerStat (ID,'Kills'); var2 := GetPlayerStat (ID,'Deaths'); var3 := var1/var2; SayToPlayer (ID, 'Skill : '+floattostr(var3)); end else begin SayToPlayer (ID, 'Score : '+inttostr(GetPlayerStat(ID,'Kills'))); SayToPlayer (ID, 'Deaths : '+inttostr(GetPlayerStat(ID,'Deaths'))); SayToPlayer (ID, 'Skill : '+inttostr(GetPlayerStat(ID,'Kills'))); end end else begin end end;end;
SayToPlayer (ID, 'Skill : '+inttostr(GetPlayerStat(ID,'Kills')));
Code: [Select]SayToPlayer (ID, 'Skill : '+inttostr(GetPlayerStat(ID,'Kills')));Notice that square box? that isn't supposed to be there. Remove that and it will start fine.
Also, your doing "Case switch of".... Your Switch variable is nothing.....
procedure OnPlayerSpeak(ID: Byte; Text: string);var var1,var2,var3: single;begincase LowerCase(GetPiece(Text,' ',0)) of // The first word, in lower case. '!help': begin SayToPlayer(ID, 'Available commands:'); SayToPlayer(ID, '!time'); SayToPlayer(ID, '!stats'); end; '!time': WriteConsole(0,'Current Server time is '+FormatDate('hh:nn:ss am/pm'),$0000FF); '!stats': begin if GetPlayerStat(ID,'Deaths')>0 then begin SayToPlayer(ID, 'Score : '+inttostr(GetPlayerStat(ID,'Kills'))); SayToPlayer(ID, 'Deaths : '+inttostr(GetPlayerStat(ID,'Deaths'))); var1:=GetPlayerStat (ID,'Kills'); var2:=GetPlayerStat (ID,'Deaths'); var3:=var1/var2; SayToPlayer(ID, 'Skill : '+floattostr(var3)); end else begin SayToPlayer(ID, 'Score : '+inttostr(GetPlayerStat(ID,'Kills'))); SayToPlayer(ID, 'Deaths : '+inttostr(GetPlayerStat(ID,'Deaths'))); SayToPlayer(ID, 'Skill : '+inttostr(GetPlayerStat(ID,'Kills'))); end; end; else begin // Whatever purpose this serves. end; end;end;