Author Topic: How can I get ping?  (Read 1835 times)

0 Members and 1 Guest are viewing this topic.

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
How can I get ping?
« on: June 08, 2013, 11:04:20 am »
I want learn ping on playerspeak with !ping
I tried sth simple;

Code: [Select]
Const
 Color = $FEDEBA; //Color to be used
ErrorColor = $FF6155; //Error's Color.


Function OnPlayerSpeak(ID: Byte; Text: String): Boolean;
 Var
  S: Integer;
   Begin
    if Text = '!ping' Then
     WriteConsole(ID,'Ping: '+IDToPing(ID),Color);

   if (GetPiece(Text,' ',0) = '!ping') AND (GetPiece(Text,' ',1) <> Nil) Then
 Try
  S := StrToInt(GetPiece(Text,' ',1));
   if GetPlayerStat(S,'Active') = True Then Begin
   WriteConsole(ID,'Ping '+IDToName(S)+': '+GetPlayerStat(S,'Ping'),Color);
  end else WriteConsole(ID,'Bu oyuncu serverde degil!!',ErrorColor);
 Except
  WriteConsole(ID,'ID belirt, isim degil!!',ErrorColor);
 end;
end;

It isn't working, compile result;
Compiling ping -> ping.pas...
ping -> [Error] (12:31): Unknown identifier 'IDToPing'
Unable to find variable
Shutting down server...
Disconnected.

What is wrong?
Is there anybody can write script?
Good, go and play soldat ^^

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: How can I get ping?
« Reply #1 on: June 08, 2013, 11:17:54 am »
 WriteConsole(ID,'Ping: '+GetPlayerStat(ID, 'Ping'),Color);
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I get ping?
« Reply #2 on: June 08, 2013, 11:39:43 am »
It doesnt work :D Nothing seems, when I typed !ping I can't see anything, in baka and in soldat :S only my text on screen :S
Is there anybody can write script?
Good, go and play soldat ^^

Offline Bonecrusher

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1397
  • High above
    • Zabijaka.pl
Re: How can I get ping?
« Reply #3 on: June 08, 2013, 12:00:51 pm »
There's a script written by Silnikos somewhere on the forums. I think its called PingRate

Im chill like that

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: How can I get ping?
« Reply #4 on: June 08, 2013, 01:03:37 pm »
@MrHamsTR: learn to pascal. Here you will find what you need: http://devs.soldat.pl/index.php/Server_Scripting
Try to solve the problem alone. Learn from your mistakes.

Code: [Select]
procedure onplayerspeak(ID: byte; Text: string);
begin
if (text='!ping') then
begin
writeconsole(ID,'Your ping: '+getplayerstat(ID,'ping'), $FFFFFFFF);
end;
end;


Combination:

When a player type !ping name, display ping another player.

Code: [Select]
function getname(Name: string): byte;
var i: byte;
begin
result := 0;
for i := 1 to 32 do
if getplayerstat(i,'active')=true then
begin
if containsstring(lowercase(getplayerstat(i,'name')),lowercase(name)) then
begin
result := i;
break;
end;
end;
end;

procedure showping(ID: byte; targetname: string);
var target:byte;
begin
if targetname <> '' then target := getname(targetname) else target := ID;
if target = 0 then begin exit;
end;
writeconsole(ID,'Player: '+getplayerstat(target,'name'),$FFFFFFFF);
writeconsole(ID,'Ping:   '+getplayerstat(target,'ping'),$FFFFFFFF);
end;

function onplayerspeak(ID: byte; Text: string): boolean;
begin
if getpiece(text,' ',0) = '!ping' then showping(ID,getpiece(text,getpiece(text,' ',0)+' ',1));
end;
« Last Edit: June 08, 2013, 01:16:58 pm by skrX »

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I get ping?
« Reply #5 on: June 08, 2013, 01:35:47 pm »
Stop the shouting!
When I want a script, everybody shout me "Learn Pascal or stfu try it, everytime you just want" etc etc

And did I tell "I didnt try write and check 2-3 times" ????
What is your problem with me!?

@Bonecrusher
If I want "please gimme ping script", sure, you will shout me.

Guys, you never respect me :(

..
Is there anybody can write script?
Good, go and play soldat ^^

Offline skrX

  • Soldier
  • **
  • Posts: 112
  • x ye.
Re: How can I get ping?
« Reply #6 on: June 08, 2013, 01:59:59 pm »
Thank for help?

Quote
When I want a script, everybody shout me "Learn Pascal or stfu try it, everytime you just want" etc etc
Quote
When I want a script

You want script?

Scripting Discussions and Help do you understand? Here are helping, correcting errors.
If someone want, write for you small script. But, how can?

When I hear such nonsense, until it makes me sick.
You modify large scripts, but you don't know the basics. You can see that you are having problems with pascal. Such simple errors.

Quote
@Bonecrusher
If I want "please gimme ping script", sure, you will shout me.

Download and search: http://forums.soldat.pl/index.php?topic=42553.0
« Last Edit: June 08, 2013, 02:07:37 pm by skrX »

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I get ping?
« Reply #7 on: June 08, 2013, 04:12:35 pm »
Yeah I want learn it I want do it, I wasnt born with English and Pascal so I cant learn it easily like you.
Good English almost everytime in here, learn see tell ask and learn. But I cant do it.
I've not got enough time and I dont know pascal language, I dont know characters what for.
I want learn yes I'm trying, old days, I was want but now I'm trying is it good? or not?
I'm happy, sure I have got 5 servers and I'm a Soldat player with you guys but problem is you never respect other player or only me I see that :/
Show me your respect and help, I did wrongs I know etc; I didnt wait and more posts I know..
But I will try and I will wait your helps okay? If 10 minutes later if 10 years later, I will wait cause I cant learn it, my English isnt good enough for it.
For all, again shout me. If you gonna warn or ban me, I will play on my servers with my 2-3 friends.

Btw, thanks for scald.
Is there anybody can write script?
Good, go and play soldat ^^

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: How can I get ping?
« Reply #8 on: June 08, 2013, 04:27:00 pm »
What's frustrating about your posts is not the fact that you keep asking questions, because that's good and in a way even appreciated. The frustrating part is that you can't even form your question properly because you don't understand the nature of the problem. And when you get the answer, you probably don't understand it.
If you want to learn pascal, ask uncle google for some pascal tutorials, i can bet that there are even some available in Turkish.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: How can I get ping?
« Reply #9 on: June 08, 2013, 04:30:21 pm »
No needed anymore thank you.
It was just a ping script.
I didnt do anything that nothing to tell them
Is there anybody can write script?
Good, go and play soldat ^^

Offline CheeSeMan.

  • Flagrunner
  • ****
  • Posts: 731
  • WOOT SLIPPERY PICKLES
Re: How can I get ping?
« Reply #10 on: June 09, 2013, 10:02:05 am »
yeah he did not do anything that nothing to tell them, so back off guys.
Banana Banging since summer 2008!     
cB. Cheeky Bananas                
#CheekyB.Soldat

Offline DevilX4

  • Major(1)
  • Posts: 30
Re: How can I get ping?
« Reply #11 on: June 16, 2013, 01:30:52 am »
yeah he did not do anything that nothing to tell them, so back off guys.
^ This. :D lol