SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 28/05/2018, 08:07 AM   #1271
RxErT
Huge Clucker
 
RxErT's Avatar
 
Join Date: May 2016
Location: SA:MP Lemon
Posts: 246
Reputation: 12
Default Re: Useful Snippets

Quote:
Originally Posted by Fungi View Post
sorry but this is a very bad way to do it
Quote:
Originally Posted by [HLF]Southclaw View Post
You have now made the problem worse by starting a timer for every update where the player has exceeded the ping limit. You'll now get the exact same chat spam but 5 seconds later.

Ping does not need to be checked every ~20ms - you can just use a 1 second timer or even 5 second.

Another thing is you don't want to instantly kick someone who just has a momentary ping spike, it happens sometimes and one or two updates with higher ping is not a problem. If you do this you will end up with very angry users.

Instead, what you want to do is store a buffer of ping samples or count the number of times a user has exceeded the limit consecutively then use that data to kick. Here's some very old code that serves as a rough example of that idea: https://github.com/Southclaws/Scaven....pwn#L221-L240
I'm very thankful for your reply! thank you so much.
__________________
Filterscript:[UPDATED] DM Event [Friendly, Funny, Controllable]
Snippet:Whisper and Car whisper commands, controllable
Discord: Flofey#8478
Github: RxErT's profile
Working-on: Administration script Based on SQLite
Love Quote: "He stepped down, trying not to look long at her, as if she were the sun, yet he saw her like the sun, even without looking." ~Leo Tolstoy - Anna Karenina
RxErT is offline   Reply With Quote
Old 28/05/2018, 05:46 PM   #1272
CodeStyle175
Huge Clucker
 
CodeStyle175's Avatar
 
Join Date: Apr 2014
Posts: 344
Reputation: 19
Default Re: Useful Snippets

when you use onplayerupdate, you have to limit the check amount. onplayerupdate is good because, when player is afk it won't be called.
CodeStyle175 is offline   Reply With Quote
Old 28/05/2018, 07:28 PM   #1273
RxErT
Huge Clucker
 
RxErT's Avatar
 
Join Date: May 2016
Location: SA:MP Lemon
Posts: 246
Reputation: 12
Default Re: Useful Snippets

Quote:
Originally Posted by CodeStyle175 View Post
when you use onplayerupdate, you have to limit the check amount. onplayerupdate is good because, when player is afk it won't be called.
Okay! Thanks for this advice!

Although I'm not gonna make it again, SouthClaw already put a link that includes a Ping kicker... so nvm
__________________
Filterscript:[UPDATED] DM Event [Friendly, Funny, Controllable]
Snippet:Whisper and Car whisper commands, controllable
Discord: Flofey#8478
Github: RxErT's profile
Working-on: Administration script Based on SQLite
Love Quote: "He stepped down, trying not to look long at her, as if she were the sun, yet he saw her like the sun, even without looking." ~Leo Tolstoy - Anna Karenina
RxErT is offline   Reply With Quote
Old 29/05/2018, 12:13 PM   #1274
SeanDenZYR
Big Clucker
 
Join Date: May 2016
Location: Philippines!!
Posts: 156
Reputation: 15
Default Re: Useful Snippets

Chat Cleaner:
Code:
CMD:chatcleaner(playerid, params[])
{
    for(new i = 0; i < 250; i++)
    {
        SendClientMessage(playerid, -1, " ");
    }
    return 1;
}
__________________

SeanDenZYR is offline   Reply With Quote
Old 09/06/2018, 04:11 PM   #1275
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Oblivion (#RIPX)
Posts: 1,462
Reputation: 263
Default Re: Useful Snippets

PHP Code:
/*
    A very simple help system to help show the usage and importance of iterator/ foreach
    along with the new dialog styles added in 0.3.7

    This is just taken out of, one of my Call of Duty scripts.

    - Logic_
*/ 
Link: https://raw.githubusercontent.com/Al...aster/help.pwn
__________________
RIP XXXTentacion [1998-2018]

My Releases: Click me!

Past experiences:
Ex- Developer of COD: Black Ops 3 [2017 - 2018], Palomino Creek RP [2018], NEG [2017], Zombieland [2015]
Logic_ is offline   Reply With Quote
Old 10/06/2018, 07:27 AM   #1276
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: Oblivion (#RIPX)
Posts: 1,462
Reputation: 263
Default Re: Useful Snippets


Team Fortress 2: Payload

PHP Code:
/*
    Documentation
    -------------
    Mode name: Payload
    Author: Logic_ (eXpose)
    Script Type: Gamemode

    A very simple implementation of TF2's Payload mode in SA-MP, originally was planned for a server which was later cancelled.
*/ 
Link: https://github.com/AliLogic/Payload-SAMP/tree/master



Gun Game: SA-MP

PHP Code:
/* 
    Documentation 
    ------------- 
    Mode name: Gun Game 
    Author: Logic_ (eXpose) 
    Script Type: Gamemode 

    A very simple implementation of CS:GO's Gun Game mode in SA-MP, originally was planned for a server which was later cancelled. 
*/ 
LINK: https://github.com/AliLogic/Gun-Game-SAMP

Last edited by Logic_; 10/06/2018 at 06:00 PM.
Logic_ is offline   Reply With Quote
Old 16/06/2018, 08:09 PM   #1277
Lokii
Big Clucker
 
Join Date: Sep 2017
Posts: 142
Reputation: 59
Default Re: Useful Snippets

Simple Lotto: Source
Lokii is offline   Reply With Quote
Old 16/06/2018, 08:34 PM   #1278
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Location: KS.
Posts: 780
Reputation: 134
Default Re: Useful Snippets

Quote:
Originally Posted by SeanDenZYR View Post
Chat Cleaner:
Code:
CMD:chatcleaner(playerid, params[])
{
    for(new i = 0; i < 250; i++)
    {
        SendClientMessage(playerid, -1, " ");
    }
    return 1;
}
Code:
stock ClearChatbox(playerid, lines)
{
    for(new i = 0; i < lines; i++)
    {
        SendClientMessage(playerid, -1, " ");
    }
    return true;
}

ClearChatbox(playerid, 20); // put how many lines you want
cuber is offline   Reply With Quote
Old 16/06/2018, 09:12 PM   #1279
Dignity
High-roller
 
Join Date: May 2013
Location: Belgium
Posts: 1,860
Reputation: 1082
Default Re: Useful Snippets

Quote:
Originally Posted by cuber View Post
Code:
stock ClearChatbox(playerid, lines)
{
    for(new i = 0; i < lines; i++)
    {
        SendClientMessage(playerid, -1, " ");
    }
    return true;
}

ClearChatbox(playerid, 20); // put how many lines you want
such a big improvement !
__________________



Dignity is online now   Reply With Quote
Old 16/06/2018, 09:23 PM   #1280
Crystallize
High-roller
 
Join Date: Aug 2013
Posts: 1,573
Reputation: 308
Default Re: Useful Snippets

Quote:
Originally Posted by Dignity View Post
such a big improvement !
I know right hahahaha he literally did nothing. LMFAO.
__________________
SAMP BATTLE GROUNDS
87.98.241.207:7780
Crystallize is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
READ Usefull Links to snippets and other -Sneaky- Help Archive 5 02/05/2009 11:22 AM


All times are GMT. The time now is 01:15 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.