0 Members and 1 Guest are viewing this topic.
constColor = $FFA07A; //Color text is shown inMineDist = 50; //Distance a player has to be for the mine to blowMinesCarry = 3; //Maximum amount of mines a player can carry at a timeMinesPlace = 10; //Maximum amount of mines allowed on the field per player at a timeGround = true; //Make this false if you want mines to be placed / checked in mid airMineMessage = true; //When a mine goes off, it displays a message to the mine owner that it blewKillMessage = true; //When a player kills somebody, this shows how much cash they have earned and total cashCapMessage = true; //When a player captures the flag, this shows how much cash they have eanred and total cash// GrabCapCash = 10; Disabled until problem fixed with a bug in scriptingCapCash = 100; //Amount of cash a player gets for capturing the flagCapAloneCheck = true; //If this is enabled, then the server will check if a player is by himself when he caps, and if he is, he earns no cashtypemInfo = recordExists: boolean;Owner: byte;X,Y: single;end;varJustJoined: array[1..32] of boolean;Spree: array[1..32] of byte;Cash: array[1..32] of integer;Enabled: array[1..6] of boolean;Cost: array[1..6] of byte;Items: array[1..32] of array[1..6] of byte;Mines: array of mInfo;// Grabber: array[1..2] of byte;function AddChr(Character: char; Num: integer): string;vari: integer;beginfor i := 1 to Num do Result := Result + Character;end;procedure PlaceMine(ID: byte);vari: integer;beginfor i := 0 to GetArrayLength(Mines) do if i = GetArrayLength(Mines) then Break else if Mines[i].Exists = false then Break;if i >= GetArrayLength(Mines) then SetArrayLength(Mines,i + 1);Mines[i].Exists := true;Mines[i].Owner := ID;GetPlayerXY(ID,Mines[i].X,Mines[i].Y);end;function ItemIDtoName(IID: byte): string;beginCase IID of1: Result := 'Zycie';2: Result := 'Granaty';3: Result := 'Granaty odlamkowe';4: Result := 'Kamizelka';5: Result := 'Mina';6: Result := 'Predator';end;end;procedure ActivateServer();beginCost[1] := 30; //ZycieCost[2] := 45; //GranatyCost[3] := 60; //Granaty OdlamkoweCost[4] := 80; //PancerzCost[5] := 100; //Miny 2 out at a time; can carry only 3Cost[6] := 120; //PredatorEnabled[1] := true;Enabled[2] := true;Enabled[3] := true;Enabled[4] := true;Enabled[5] := true;Enabled[6] := true;end;procedure AppOnIdle(Ticks: integer);vari,j: integer;X,Y: single;beginif Enabled[6] then for i := 0 to GetArrayLength(Mines) - 1 do if Mines[i].Exists then beginfor j := 1 to 32 do if GetPlayerStat(j,'Active') = true then if (GetPlayerStat(j,'Alive') = true) and (GetPlayerStat(Mines[i].Owner,'Team') <> GetPlayerStat(j,'Team')) then beginGetPlayerXY(j,X,Y);if (Distance(X,Y,Mines[i].X,Mines[i].Y) <= MineDist) and ((Ground = false) or ((Ground) and (GetPlayerStat(j,'Ground') = true))) then beginCreateBullet(X,Y,0,5,200,4,Mines[i].Owner);CreateBullet(Mines[i].X,Mines[i].Y,0,5,200,4,Mines[i].Owner);CreateBullet((Mines[i].X + X) / 2,(Mines[i].Y + Y) / 2,0,5,200,4,Mines[i].Owner);CreateBullet((Mines[i].X + X) / 2,(Mines[i].Y + Y) / 2 - 20,0,5,200,4,Mines[i].Owner);Mines[i].Exists := false;if MineMessage then WriteConsole(Mines[i].Owner,GetPlayerStat(j,'Name') + ' has tripped in your mine.',Color);end;end;end;if Ticks mod (60 * 60 * 5) = 0 then WriteConsole(0,'Co to za kasa? Co moge kupic i jak? Wyjasnienie w /help',Color);end;procedure OnJoinGame(ID, Team: byte);beginJustJoined[ID] := true;Cash[ID] := 0;end;procedure OnJoinTeam(ID, Team: byte);begin// if Grabber[iif(Team = 1,2,1)] = ID then Grabber[iif(Team = 1,2,1)] := 0;if JustJoined[ID] then beginWriteConsole(0,'Co to jest za kasa? Co moge kupic i jak? Wyjasnienie w /help',Color);JustJoined[ID] := false;end;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);vari: byte;begin// if Grabber[Team] = ID then Grabber[Team] := 0;i := 1;while Cash[ID] > 0 do beginCash[ID] := Cash[ID] - 1;Cash[i] := Cash[i] + 1;if i = 32 then i := 1 else i := i + 1;end;end;procedure OnFlagGrab(ID, TeamFlag: byte; GrabbedInBase: boolean);begin// if GrabbedInBase then Grabber[StrtoInt(iif(TeamFlag = 1,'2','1'))] := ID;end;procedure OnFlagReturn(ID, TeamFlag: byte);begin// Grabber[TeamFlag] := 0;end;procedure OnFlagScore(ID, TeamFlag: byte);begin{if ID = Grabber[TeamFlag] then beginCash[ID] := Cash[ID] + GrabCapCash;if CapMessage then WriteConsole(ID,'Zdobyles $' + InttoStr(GrabCapCash) + ' for capturing the flag. ($' + InttoStr(Cash[ID]) + ')',Color);end else }if iif(TeamFlag = 1,AlphaPlayers,BravoPlayers) <> 0 then beginCash[ID] := Cash[ID] + CapCash;if CapMessage then WriteConsole(ID,'Zdobyles $' + InttoStr(CapCash) + ' za nabicie punktu flagą. ($' + InttoStr(Cash[ID]) + ')',Color);end else WriteConsole(ID,'You have captured the flag while alone. No money nor points for you!',Color);//Grabber[TeamFlag] := 0;end;function OnPlayerCommand(ID: Byte; Text: string): boolean;varMineSet: boolean;i,Item,Total,Who: byte;Amount: integer;LText: string;beginResult := false;LText := LowerCase(Text);if LText = '/items' then beginWriteConsole(ID,'ID Nazwa operacji Poszczegolne koszta',Color);for i := 1 to 6 do if Enabled[i] then WriteConsole(ID,InttoStr(i) + ': ' + ItemIDtoName(i) + AddChr(' ',17 - Length(ItemIDtoName(i))) + '$' + InttoStr(Cost[i]),Color);end if LText = '/cash' then WriteConsole(ID,'Aktualnie posiadasz $' + InttoStr(Cash[ID]) + '.',Color) else if GetPiece(LText,' ',0) = '/buy' then begintryItem := StrtoInt(Copy(LText,6,Length(LText)));exceptend;if (Item >= 1) and (Item <= 6) then beginif Enabled[Item] then beginif (Item <> 5) or ((Item = 5) and (Items[ID][5] < MinesCarry)) then beginif Cash[ID] >= Cost[Item] then beginItems[ID][Item] := Items[ID][Item] + 1;Cash[ID] := Cash[ID] - Cost[Item];WriteConsole(ID,'Kupiles bonus! Aby go uzyc wpisz w cmd ''/use ' + InttoStr(Item) + '''.',Color);end else WriteConsole(ID,'Masz za malo pieniedzy. ($' + InttoStr(Cash[ID]) + ' / $' + InttoStr(Cost[Item]) + ')',Color);end else WriteConsole(ID,'Masz limit ' + InttoStr(MinesCarry) + ' mines at a time.',Color);end else WriteConsole(Id,'Ta opca zostala zdezaktywoana.',Color);end else WriteConsole(ID,'Zly numer operacji.',Color);end else if GetPiece(LText,' ',0) = '/use' then begintryItem := StrtoInt(Copy(LText,6,Length(LText)));exceptend;if (Item >= 1) and (Item <= 6) then beginif Enabled[Item] then beginif Items[ID][Item] > 0 then beginCase Item of1: DoDamage(ID,GetPlayerStat(ID,'Health') - iif(Command('/realistic') = '1',65,150));2: GiveBonus(ID,4);3: GiveBonus(ID,5);4: GiveBonus(ID,3);5: beginif ((Ground = false) or ((Ground) and (GetPlayerStat(ID,'Ground') = true))) then beginif GetArrayLength(Mines) <> 0 then for i := 0 to GetArrayLength(Mines) - 1 do if (Mines[i].Exists) and (Mines[i].Owner = ID) then Total := Total + 1;if Total <= MinesPlace then beginPlaceMine(ID);MineSet := true;end else WriteConsole(ID,'Masz limit dwoch min.',Color);end else WriteConsole(ID,'Musisz stac na ziemi zeby podlozyc mine.',Color);end;6: GiveBonus(ID,1);end;if (Item <> 5) or (MineSet) then beginItems[ID][Item] := Items[ID][Item] - 1;WriteConsole(ID,ItemIDtoName(Item) + ' aktywowana! (' + InttoStr(Items[ID][Item]) + ' remaining)',Color);end;end else WriteConsole(ID,'Nie posiadasz takiego itemu.',Color);end else WriteConsole(ID,'This item has been disabled.',Color);end else WriteConsole(ID,'Invalid ID input.',Color);end else if LText = '/help' then beginWriteConsole(ID,' SKLEP',Color);WriteConsole(ID,'Kase dostajemy za zabitego gracza, badz nabicie punktu flagą.',Color);WriteConsole(ID,'Są trzy bonusy ktore mozesz kupic:',Color);WriteConsole(ID,'Kamizelka, Miny, Predator.',Color);WriteConsole(ID,'Wpisz /items w cmd zeby zobaczyc ceny',Color);WriteConsole(ID,'potem wpisz /buy ID zeby wykupic bonus ',Color);WriteConsole(ID,'Zeby aktywowac bonus wpisz /use ID',Color);WriteConsole(ID,'ID to numer bonusu widoczny po lewej stronie',Color);end else if LText = '/commands' then beginWriteConsole(ID,' Curt''s Buying',Color);WriteConsole(ID,'/items View item prices',Color);WriteConsole(ID,'/cash Shows your current amount of cash',Color);WriteConsole(ID,'/buy # Buying item ID #',Color);WriteConsole(ID,'/use # Using item ID #',Color);WriteConsole(ID,'/help Help with using the script',Color);WriteConsole(ID,'/commands Brings this menu up',Color);end else if GetPiece(LText,' ',0) = '/give' then begintryWho := StrtoInt(GetPiece(LText,' ',1));Amount := StrtoInt(GetPiece(LText,' ',2));exceptWriteConsole(ID,'Error...',Color);end;if (Who >= 1) and (Who <= 32) then beginif GetPlayerStat(Who,'Active') = true then beginif Amount > 0 then beginif GetPlayerStat(ID,'Team') = GetPlayerStat(Who,'Team') then beginif Cash[ID] >= Amount then beginWriteConsole(ID,'You have given ' + GetPlayerStat(Who,'Name') + ' $' + InttoStr(Amount) + '.',Color);WriteConsole(Who,GetPlayerStat(ID,'Name') + ' has given you $' + InttoStr(Amount) + '.',Color);Cash[Who] := Cash[Who] + Amount;end else WriteConsole(ID,'Masz za malo piniedzy zeby to kupic.',Color);end else WriteConsole(ID,'You may only give cash to an friendly player.',Color);end else if Amount < 0 then WriteConsole(ID,'You cannot steal cash from somebody...',Color) else WriteConsole(ID,'This will have no effect.',Color);end else WriteConsole(ID,'Invalid ID.',Color);end else WriteConsole(ID,'Invalid ID.',Color);end;end;procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);varTeamed: boolean;beginif (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then Teamed := false else Teamed := true;if Teamed then beginif GetPlayerStat(Killer,'Team') <> GetPlayerStat(Victim,'Team') then beginif Killer <> Victim then beginCash[Killer] := Cash[Killer] + 3 + Spree[Killer] + Spree[Victim];if KillMessage then WriteConsole(Killer,'Zabiles gracza ' + GetPlayerStat(Victim,'Name') + ' za $' + InttoStr(3 + Spree[Killer] + Spree[Victim]) + '. ($' + InttoStr(Cash[Killer]) + ')',Color);Spree[Killer] := Spree[Killer] + 1;end;Spree[Victim] := 0;end else if Killer = Victim then Spree[Victim] := 0;end else beginCash[Killer] := Cash[Killer] + 2 + Spree[Killer];if Killer <> Victim then Spree[Killer] := Spree[Killer] + 1;Spree[Victim] := 0;end;end;
const//TEAMSALPHA = 1;BRAVO = 2;CHARLIE = 3;DELTA = 4;SPECTATOR = 5;//GAME MODESDEATHMATCH = 0;POINTMATCH = 1;TEAMMATCH = 2;CTF = 3;RAMBO = 4;INF = 5;HTF = 6;//WEAPONSDEAGLES = 1;HKMP5 = 2;AK74 = 3;STEYR = 4;SPAS = 5;RUGER = 6;M79 = 7;BARRET = 8;MINIMI = 9;MINIGUN = 10;FLAMER = 11;BOW = 12;FLAMEBOW = 13;SOCOM = 0;KNIFE = 14;CHAINSAW = 15;LAW = 16;MAXTEAMS = 5;MAXPLAYER = 16;//VARIABLESvaringameKills, ingameDeaths, ingameSelfkills: array [1..MAXPLAYER] of integer;nickname_Password, nickname_IP: array [1..MAXPLAYER] of string;nickname_Name, nickname_Kills, nickname_Deaths, nickname_Selfkills: array [1..MAXPLAYER] of string;oldPassword, newPassword: array [1..MAXPLAYER] of string;nickStatus: array [1..MAXPLAYER] of integer;GOOD: longint;BAD: longint;kdKills, kdDeaths: array [1..MAXPLAYER] of integer;kdRatio: array [1..MAXPLAYER] of single;//ARRAYHIGHfunction arrayHi( tester: TStringArray ): integer;beginresult := GetArrayLength( tester ) - 1;end;//XSPLITfunction xsplit(const source: string; const delimiter: string):TStringArray;vari,x,d:integer;s:string;begind:=length(delimiter);x:=0;i:=1;SetArrayLength(Result,1);while(i<=length(source)) do begins:=Copy(source,i,d);if(s=delimiter) then begini:=i+d;inc(x,1);SetArrayLength(result,x+1);end else beginresult[x]:= result[x]+copy(s,1,1);inc(i,1);end;end;if Result[ArrayHi(Result)]='' then SetArrayLength(result,x);end;//ACTIVATESERVERprocedure ActivateServer();varb: byte;begin//change these if you want a other colours for GOOD/BAD writeconsole messagesGOOD := $EE00FF00;BAD:= $FFFF4444;//set all ID's logged outfor b := 1 to MAXPLAYER dobeginnickStatus[b] := 0;IngameKills[b] := 0;IngameDeaths[b] := 0;IngameSelfkills[b] := 0;nickname_Name[b] := '';nickname_Password[b] := '';nickname_IP[b] := '';nickname_Kills[b] := '';nickname_Deaths[b] := '';nickname_Selfkills[b] := '';kdKills[b] := 0;kdDeaths[b] := 0;kdRatio[b] := 0;oldPassword[b] := '';newPassword[b] := '';endend;//APPONIDLEprocedure AppOnIdle(Ticks: integer);beginend;//FILTERFILENAMEfunction filterFilename(filename: string):string;vari,len: byte;c: string;beginlen := length(filename);result := '';for i := 1 to len dobeginc := copy(filename,i,1);if (c=chr(92)) or (c='/') or (c='\') or (c=':') or (c='*') or (c='?') or (c='"') or (c='<') or (c='>') or (c='|') or (c='.') thenresult := result + '_'elseresult := result + c;endend;//LOADNICKNAMEfunction loadNickname(nick: string; ID: byte): string;vartemparray: TStringArray;fileData,fileName: string;begin//filter player namefileName := filterFileName( nick );//check if player profile exists and load profile in stringif FileExists('stats/nickreg/'+filename+'.txt') = true thenbeginfiledata := ReadFile('stats/nickreg/'+filename+'.txt')//split all profile into a arraytemparray := xsplit(filedata,chr(13)+chr(10));nickname_Name[ID] := temparray[0];nickname_Password[ID] := temparray[1];nickname_IP[ID] := temparray[2];nickname_Kills[ID] := temparray[3];nickname_Deaths[ID] := temparray[4];nickname_Selfkills[ID] := temparray[5];result := nickname_Password[ID];end elsebegin//if file does't exist then ask player to create profile and set all his ID info emptyWriteConsole(ID,'/create password - free account!!',GOOD);nickStatus[ID] := 0;nickname_Name[ID] := '';nickname_Password[ID] := '';nickname_Ip[ID] := '';result := '';endend;//SAVE NICKNAMEprocedure SaveNickname(name,password,ip: string; NewKills,NewDeaths,NewSelfkills: integer; currentDate:string; ID: byte);varfilename,outdata: string;begin//filter player namefilename := FilterFilename(name);//check is nickname doens't already existif FileExists('stats/nickreg/'+filename+'.txt') = true thenbeginWriteConsole( ID, 'Nickname already exists!', BAD );end elsebegincurrentDate := FormatDate('dd:mm:yy');//set data to writeoutdata := name+chr(13)+chr(10)+password+chr(13)+chr(10)+ip+chr(13)+chr(10)+inttostr(NewKills)+chr(13)+chr(10)+inttostr(NewDeaths)+chr(13)+chr(10)+inttostr(NewSelfkills)+chr(13)+chr(10)+currentDate+chr(13)+chr(10);//write new profileWriteFile('stats/nickreg/'+filename+'.txt',outdata);endend;//UPDATE NICKNAMEprocedure UpdateNickname(nick: string; ID: byte);vartemparray: TStringArray;OldKills,OldDeaths,OldSelfkills: integer;NewKills,NewDeaths,NewSelfkills: integer;outdata: string;fileName, fileData: string;ip, currentDate: string;beginfilename := FilterFilename(nick);if getPlayerStat( ID, 'Active' ) thenbegin//if nickname existsfiledata := ReadFile('stats/nickreg/'+filename+'.txt');//check if player is logged in to update new statsif nickStatus[ID] = 1 thenbegin//check if file wasn't emptyif filedata <> '' thenbegin//split datatemparray := xsplit(filedata,chr(13)+chr(10));Nickname_IP[ID] := temparray[2];Nickname_Kills[ID] := temparray[3];Nickname_Deaths[ID] := temparray[4];Nickname_Selfkills[ID] := temparray[5];//get old kills/deaths/selfkills from dataOldKills := strtoint(Nickname_Kills[ID]);OldDeaths := strtoint(Nickname_Deaths[ID]);OldSelfkills := strtoint(Nickname_Selfkills[ID]);//count new kills/deats/selfkillsNewKills := OldKills + IngameKills[ID];NewDeaths := OldDeaths + IngameDeaths[ID];NewSelfkills := OldSelfkills + IngameSelfkills[ID];//get player ip and currentdateip := getPlayerStat( ID, 'ip');currentDate := FormatDate('dd:mm:yy');//set data to writeoutdata := nickname_Name[ID]+chr(13)+chr(10)+Nickname_Password[ID]+chr(13)+chr(10)+ip+chr(13)+chr(10)+inttostr(NewKills)+chr(13)+chr(10)+inttostr(NewDeaths)+chr(13)+chr(10)+inttostr(NewSelfkills)+chr(13)+chr(10)+currentDate+chr(13)+chr(10);//update the player profileWriteFile('stats/nickreg/'+filterFileName(nickname_Name[ID])+'.txt',outdata);end elsebegin//if data inside profile was empty clear the name, pass and ipNickname_Name[ID] := '';Nickname_Password[ID] := '';Nickname_IP[ID] := '';endend elsebeginWriteln('Player did not login for stats!');endendend;//ONCOMMANDfunction OnCommand(ID: Byte; Text: string): boolean;beginResult := false;end;//ONPLAYERCOMMANDfunction OnPlayerCommand(ID: Byte; Text: string): boolean;varinputNick, tempNick, InputPassword, InputPasswordLogin, nick: string;currentDate: string;begin//displays player statsif (Copy(Text,1,6) = '/stats') thenbeginif GetPlayerStat(ID, 'Active') = true thenbeginnick := GetPlayerStat(ID,'name');//check if player already got profile or notif FileExists('stats/nickreg/'+filterFileName(nick)+'.txt') = true thenbegin//load player profileLoadNickname(FilterFilename(GetPlayerStat(ID,'name')),ID);//display statsWriteConsole(ID,'Kills: ' +nickName_Kills[ID],GOOD);WriteConsole(ID,'Deaths: ' +nickName_Deaths[ID],GOOD);WriteConsole(ID,'SelfKills: '+nickName_SelfKills[ID],GOOD);//check if player has more then 0 deaths otherwise its divide by zeroif strtoint(nickName_Deaths[ID]) > 0 thenbeginkdKills[ID] := strtoint(nickName_Kills[ID]);kdDeaths[ID] := strtoint(nickName_Deaths[ID]);kdRatio[ID] := kdKills[ID] / kdDeaths[ID];WriteConsole(ID,'K/D Ratio: '+floattostr(roundto(kdRatio[ID],2)),GOOD);endend elsebeginWriteConsole(ID,'Nie masz konta na serwerze jeszcze!',BAD);endendend//create new accountif (Copy(Text,1,8) = '/create ') thenbegin//check if player isn't logged in alreadyif nickStatus[ID] = 0 thenbegin//check if player is activeif GetPlayerStat(ID, 'Active') = true thenbegin//get player nicknick := GetPlayerStat(ID,'name');//check if player already got profile or notif FileExists('stats/nickreg/'+filterFileName(nick)+'.txt') = false thenbegin//get his password from textInputPassword := Text;delete(InputPassword,1,8);//if input isn't emptyif InputPassword <> '' thenbegin//check password lengthif length(inputPassword) < 17 thenbegin//Get the current datecurrentDate := FormatDate('hh:nn:ss am/pm');//Save player account into fileSaveNickname(GetPlayerStat(ID,'name'),InputPassword,GetPlayerStat(ID,'ip'),0,0,0,currentDate, ID);WriteConsole(ID,'Nickname ' + GetPlayerStat(ID,'name') + ' successfully registered!',GOOD);WriteConsole(ID,'Nickname ' + GetPlayerStat(ID,'name') + ' now logged in!',GOOD);WriteConsole(ID,'Your password is ' + InputPassword + ' - do not forget it!',GOOD);WriteLn('NickReg: ' + GetPlayerStat(ID,'name') + ' registered from ' + GetPlayerStat(ID,'ip'));//login player that registerednickStatus[ID] := 1;end elsebeginWriteConsole(ID,'Max length password is 16 characters!',BAD);endend elsebeginWriteConsole(ID,'No password found. Please try again.',BAD);endend elsebeginWriteConsole(ID,'You are already a registered user!',BAD);endendendend//change passwordif (Copy(Text,1,12) = '/changepass ') thenbegin//check if player is logged inif nickStatus[ID] = 1 thenbegin//check if player is activeif GetPlayerStat(ID, 'Active') = true thenbegin//get player nicknick := GetPlayerStat(ID,'name');//check if player already got profile or notif FileExists('stats/nickreg/'+filterFileName(nick)+'.txt') = true thenbegin//get his password from textInputPassword := Text;delete(InputPassword,1,12);//set old and new passwordoldPassword[ID] := GetPiece(InputPassword,' ',0);newPassword[ID] := GetPiece(InputPassword,' ',1);//check if old password matchif oldPassword[ID] = nickName_Password[ID] thenbegin//check length of his newpasswordif length(newPassword[ID]) < 17 thenbegin//set new password to IDnickName_Password[ID] := newPassWord[ID];//save new password to profileUpdateNickname(GetPlayerStat(ID,'name'),ID);WriteConsole(ID,'Password changed to: '+newPassword[ID],GOOD);end elsebeginWriteConsole(ID,'Max length password is 16 characters!',BAD);endend elsebeginWriteConsole(ID,'Wrong password!',BAD);endend elsebeginWriteConsole(ID,'No profile found!',BAD);endendend elsebeginWriteConsole(ID,'Please login first!',BAD);endend//change nicknameif (Copy(Text,1,12) = '/changenick ') thenbegin//check if player is logged inif nickStatus[ID] = 1 thenbegin//check if player is activeif GetPlayerStat(ID, 'Active') = true thenbegin//get player nicknick := GetPlayerStat(ID,'name');//check if player already got profile or notif FileExists('stats/nickreg/'+filterFileName(nick)+'.txt') = true thenbegin//get his password and nick from textInputNick := Text;delete(InputNick,1,12);//check if password is rightif nickName_Password[ID] = GetPiece(InputNick,' ',0) thenbegin//check length of his new nicknameif length(GetPiece(InputNick,' ',1)) < 25 thenbegin//set new nickname to ID and check if that nick already existstempNick := GetPiece(InputNick,' ',1);if FileExists('stats/nickreg/'+filterFileName(tempNick)+'.txt') = false thenbegin//set new nickname to IDnickName_Name[ID] := GetPiece(InputNick,' ',1);//save new password to profileUpdateNickname(GetPlayerStat(ID,'name'),ID);WriteConsole(ID,'NickName changed to: '+nickName_Name[ID],GOOD);WriteConsole(ID,'Please rejoin the server with your new nick to load your new profile',GOOD);end elsebeginWriteConsole(ID,'That nickname is already taken!',BAD);endend elsebeginWriteConsole(ID,'Nickname is over 24 characters, please pick another',BAD);endend elsebeginWriteConsole(ID,'Wrong Password!',BAD);endend elsebeginWriteConsole(ID,'No profile found!',BAD);endendend elsebeginWriteConsole(ID,'Please login first!',BAD);endend//loginif (Copy(Text,1,7) = '/login ') thenbegin//check if player isn't logged in yetif (nickStatus[ID] = 0) thenbegin//if player is activeif GetPlayerStat(ID, 'Active')= true thenbegin//get player nicknick := getPlayerStat(ID, 'Name' );if FileExists('stats/nickreg/'+filterFileName(nick)+'.txt') = true thenbegin//get password from textInputPasswordLogin := Text;delete(InputPasswordLogin,1,7);//Check password loginif InputPasswordLogin = Nickname_Password[ID] thenbegin//login the player and set tasktimernickStatus[ID] := 1;WriteConsole(ID,'You are now logged in!',GOOD);end elsebeginWriteConsole(ID,'Wrong password!',BAD);endend elsebeginWriteConsole(ID,'No profile found!',BAD);endendend elsebeginWriteConsole(ID,'Jestes zalogowany!',BAD);endend//Logoutif (Copy(Text,1,7) = '/logout') thenbegin//check is player is logged inif (nickStatus[ID] = 1) thenbeginWriteConsole(ID,'Wylogowales sie!',GOOD);WriteConsole(ID,'Wpisz /login ''password'' zeby sie zalogowac.',GOOD);//set player status to logged outnickStatus[ID] := 0;end elsebeginWriteConsole(ID,'Wlasnie sie wylogowales!',BAD);endendResult := false;end;//ONPLAYERSPEAKprocedure OnPlayerSpeak(ID: byte; Text: string);beginif (copy(Text,1,9) = '!commands') thenbeginWriteConsole(ID,'Commands are: /login, /logout, /changepass, /changenick, /stats',GOOD);WriteConsole(ID,'!login for example will display info how to login',GOOD);endif (copy(Text,1,6) = '!login') thenbeginWriteConsole(ID,'Type /login ''your password'' to login',GOOD);endif (copy(Text,1,7) = '!logout') thenbeginWriteConsole(ID,'Type /logout ''your password'' to logout',GOOD);endif (copy(Text,1,11) = '!changepass') thenbeginWriteConsole(ID,'Type /changepass ''old password'' ''new password'' to set a new password',GOOD);endif (copy(Text,1,11) = '!changenick') thenbeginWriteConsole(ID,'Type /changenick ''your password'' ''new nickname'' to set a new nickname',GOOD);endif (copy(Text,1,6) = '!stats') thenbeginWriteConsole(ID,'Type /stats to view your current stats',GOOD);endend;//JOINTEAMprocedure OnJoinTeam(ID, Team: byte);begin//check if player is activeif getPlayerStat( ID, 'Active' ) = true thenbegin//kick player if nickname is above 24 charactersif length(getPlayerStat( ID, 'name' )) > 24 thenbeginWriteConsole(ID,'...your name is over 24 characters, please change it.',BAD);KickPlayer(ID);end//load player profileLoadNickname(FilterFilename(GetPlayerStat(ID,'name')),ID);//check if the ip's matchif nickname_IP[ID] <> '' thenbeginif (getPlayerStat( ID, 'ip' )) = nickname_IP[ID] thenbegin//login the player and set tasktimernickStatus[ID] := 1;WriteConsole(ID,'Twoj profil zaktualizowany! Welcome!',GOOD);WriteConsole(ID,'Statystyki wlaczone!!',GOOD);WriteConsole(ID,'Wpisz /stats zeby sprawdzic statystyki!',GOOD);end elsebeginnickStatus[ID] := 0;WriteConsole(ID,'IP changed. Type /login ''password'' to login!',GOOD);endendendend;//ONLEAVEGAMEprocedure OnLeaveGame(ID, Team: byte; Kicked: boolean);begin//check if player is logged inif (nickStatus[ID] = 1) thenbegin//update his stats before he leftUpdateNickname(GetPlayerStat(ID,'name'),ID);end//unset all player variablesnickStatus[ID] := 0;IngameKills[ID] := 0;IngameDeaths[ID] := 0;IngameSelfkills[ID] := 0;nickname_Name[ID] := '';nickname_Password[ID] := '';nickname_IP[ID] := '';nickname_Kills[ID] := '';nickname_Deaths[ID] := '';nickname_Selfkills[ID] := '';kdKills[ID] := 0;kdDeaths[ID] := 0;kdRatio[ID] := 0;oldPassword[ID] := '';newPassword[ID] := '';end;//ONPLAYERKILLprocedure OnPlayerKill(Killer, Victim: byte; Weapon: string);begin//if player is suicidalif (Killer = Victim) thenbegin//check if player is logged inif nickStatus[Killer] = 1 thenbegin//increase selfkills with 1IngameSelfkills[killer] := IngameSelfkills[killer] +1;endend//if player isn't the victimif (killer <> victim) thenbegin//check is killer is logged inif nickStatus[Killer] = 1 thenbegin//increase kills of killer with 1IngameKills[killer] := IngameKills[killer] +1;end//check is victim is logged inif nickStatus[victim] = 1 thenbegin//increase deaths of victim with 1IngameDeaths[victim] := IngameDeaths[victim] +1;endendend;//ONFLAGSCOREprocedure OnFlagScore(ID, TeamFlag: byte);beginend;//MAPCHANGEprocedure OnMapChange(NewMap: string);vari: byte;begin//reset kills,deaths,selfkillsfor i := 1 to MAXPLAYER dobegin//check if player is logged inif (nickStatus[i] = 1) thenbegin//update his stats before map changesUpdateNickname(GetPlayerStat(i,'name'),i);IngameKills[i] := 0;IngameDeaths[i] := 0;IngameSelfkills[i] := 0;endendend;
My question: can script Nick Name Registration save the money, when i kill player, cap flag, and anything (script Buy)?
REF? OMG!!!!!! HELP 111ONEONE
Learn scripting by yourself !Is what Swompie,croat1gamer and other said to me each time i want help for script !! ps: Don't Worry, Be happy
Quote from: mich1103 on March 20, 2010, 07:06:36 amLearn scripting by yourself !Is what Swompie,croat1gamer and other said to me each time i want help for script !! ps: Don't Worry, Be happy gtfo.