Author Topic: Buddy Warper  (Read 1391 times)

0 Members and 2 Guests are viewing this topic.

Offline MFA

  • Major(1)
  • Posts: 15
Buddy Warper
« on: April 02, 2010, 05:36:18 am »
Script Name: Buddy Warper
Script Description: Allow one player to teleport to other player, if it is it buddy.
Original Author(s): MFA
Compile Test: Passed
Core Version: 2.5.5
Full Description: If any two players want to be their buddys, one of it write !buddy ID. Player which have this ID can write !accept to accept be a first player buddy, or !reject to don't accept. When two players are buddys, they any of it can write !warp to teleport to the second player, or !leave to leave this buddy.
I hope, so explained that comprehensibly :]
Code:
Code: [Select]
//   -------------------------------------
//   | WARP and BUDDY CREATOR SCRIPT |
//   |                    by MFA                   |
//   -------------------------------------

var
buddyid: array[1..32] of integer; //buddyid[BUDDY_ID1], VALUE = BUDDY_ID2
buddy: array[1..32] of boolean; //buddy[ID] = true if have buddy, false if havent it
buddyaccept: array[1..32] of integer; //buddyaccept[NEED_BUDDY_ID], VALUE = NEED_IT_BUDDY_ID
temp: integer; //temp value

procedure OnPlayerSpeak(ID: byte; Text: string);
begin

//WARP CREATOR
if MaskCheck(Text,'!buddy *') then begin

temp := strtoint(Copy(Text,8,length(Text))); //set temp to buddy value

if (GetPlayerStat(temp,'Active') = true) then begin //if player ingame

if (buddy[ID] = false) OR (buddy[temp] = false) then begin //if this player or you havent any other buddy

buddyaccept[temp] := ID; //set buddyaccept[ID2] to ID1
WriteConsole(temp,IDToName(ID)+' needs to be your buddy!.',$EE81FAA1); //message to ID2
WriteConsole(temp,'Type !accept or !reject.',$EE81FAA1); //message to ID2
WriteConsole(ID,'Asking '+IDToName(temp)+' to be your buddy...',$EE81FAA1); //message to ID1

end else WriteConsole(ID,'You or He have another buddy.',$EE81FAA1); //message to ID1

end else WriteConsole(ID,'This player isnt ingame.',$EE81FAA1); //message to ID1

end;

//ACCEPT BUDDY
if (Text = '!accept') then begin

if (buddyaccept[ID] <> 0) then begin //if player have any buddy proposition to accept

WriteConsole(ID,IDToName(buddyaccept[ID])+' is now your buddy.',$EE81FAA1); //message to ID2
WriteConsole(ID,'Use !warp to teleport to he.',$EE81FAA1); //message to ID2
WriteConsole(buddyaccept[ID],IDToName(ID)+' is now your buddy.',$EE81FAA1); //message to ID1
WriteConsole(buddyaccept[ID],'Use !warp to teleport to he.',$EE81FAA1); //message to ID1

buddy[ID] := true; //buddy[ID2] := true
buddyid[ID] := buddyaccept[ID]; //buddyid[ID2] := ID1
buddy[buddyaccept[ID]] := true; //buddy[ID1] := true
buddyid[buddyaccept[ID]] := buddyid[ID]; //buddyid[ID1] := ID2
buddyaccept[buddyaccept[ID]] := 0; //buddy propositon ID2 := 0
buddyaccept[ID] := 0; //buddy propositon ID1 := 0

end else WriteConsole(ID,'You havent any buddy proposition.',$EE81FAA1); //message to ID2

end;

//REJECT BUDDY
if (Text = '!reject') then begin

if (buddyaccept[ID] <> 0) then begin //if player have any buddy proposition to accept

WriteConsole(ID,'Rejected.',$EE81FAA1); //message to ID2
WriteConsole(buddyaccept[ID],IDToName(ID)+' rejected your buddy proposition.',$EE81FAA1); //message to ID1
buddyaccept[buddyaccept[ID]] := 0; //Set buddyaccept ID2 to 0
buddyaccept[ID] := 0; //Set buddyaccept ID1 to 0

end else WriteConsole(ID,'You havent any buddy proposition.',$EE81FAA1); //message to ID2

end;

//WARP
if (Text = '!warp') then begin

if (buddy[ID] = true) AND (buddyid[ID] <> 0) then begin //If you have buddy

MovePlayer(ID, GetPlayerStat(buddyid[ID], 'X'), GetPlayerStat(buddyid[ID], 'Y'));
WriteConsole(ID,'Warped.',$EE81FAA1); //message
WriteConsole(buddyid[ID],'Your buddy warped to you.',$EE81FAA1); //message

end else WriteConsole(ID,'You havent any buddy.',$EE81FAA1); //message

end;

//LEAVE
if (Text = '!leave') then begin

if (buddy[ID] = true) AND (buddyid[ID] <> 0) then begin //If you have buddy

WriteConsole(ID,'Leave.',$EE81FAA1); //message
WriteConsole(buddyid[ID],'Your buddy leave you.',$EE81FAA1); //message
buddyid[buddyid[ID]] := 0;
buddy[buddyid[ID]] := false;
buddyid[ID] := 0;
buddy[ID] := false;

end else WriteConsole(ID,'You havent any buddy.',$EE81FAA1); //message

end;

//HELP
if (Text = '!help') then begin

WriteConsole(ID,'-----------------',$EE81FAA1);
WriteConsole(ID,'WARP SCRIPT HELP:',$EE81FAA1);
WriteConsole(ID,'!buddy ID - Ask ID to be your buddy',$EE81FAA1);
WriteConsole(ID,'!accept - Accept buddy proposition',$EE81FAA1);
WriteConsole(ID,'!reject - Reject buddy proposition',$EE81FAA1);
WriteConsole(ID,'!warp - Teleport to your buddy',$EE81FAA1);
WriteConsole(ID,'!leave - Leave your buddy',$EE81FAA1);
WriteConsole(ID,'  SCRIPT BY MFA  ',$EE81FAA1); //PLEASE, DONT DELETE THIS LINE :(
   //PLEASE, IF YOU MODIFED SCRIPT LEAVE ORGINAL AUTHOR :(
WriteConsole(ID,'-----------------',$EE81FAA1);

end;

end;
« Last Edit: April 03, 2010, 09:06:11 am by MFA »

Offline freestyler

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 326
Re: Warp and Warp Creator
« Reply #1 on: April 02, 2010, 04:09:10 pm »

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: Warp and Warp Creator
« Reply #2 on: April 02, 2010, 04:20:53 pm »
lol what.
+1  ;D

Name it like Buddy Warper or such a thing.
Even though this script is a nice idea D; Isn't it on some climb server?

Offline MFA

  • Major(1)
  • Posts: 15
Re: Warp and Warp Creator
« Reply #3 on: April 03, 2010, 02:31:36 am »
lol what.
I make it like on a m79 climbs.

Name it like Buddy Warper or such a thing.
Good idea :]

Even though this script is a nice idea D; Isn't it on some climb server?
Similar is on JYPD m79 (free/hard)style. This script is e.g. in my m79 climb server (but don't working by moveplayer bug ;[)