[FilterScript] Version kick.
#21

PHP Code:

if(strcmp(version"0.3.7-R2"))
{
    
SendClientMessage(playeridCOLOR_ROUGE_CLAIR"Please install the latest version of SA:MP.");
    
SetTimerEx("kickdisplayer"10000"d"playerid);

Reply
#22

Quote:
Originally Posted by RogueDrifter
View Post
posting a snippet under a post called useful snippets and calling it useless, yeah you've been proven to be your true self, gj.
Gotta give you that one.

+1

Reply
#23

Quote:
Originally Posted by rfr
View Post
Gotta give you that one.

+1

Lmfao, thanks, and im confused as to what you mean by your previous reply @ that quoted code...?
Reply
#24

Quote:
Originally Posted by RogueDrifter
View Post
Lmfao, thanks, and im confused as to what you mean by your previous reply @ that quoted code...?
oh dont worry about it :P
Reply
#25

Okay.
Reply
#26

0.3.8 kicks the player imedi. when he is using lower versions.
Anyway, You've spent shitload time on this, And you've done a really great job regardless if its useful or not.
Reply
#27

It's more a snippet than anything,

Code:
new samp_version[16]; GetPlayerVersion(playerid, samp_version, sizeof(samp_version));
if(strcmp(samp_version, "0.3.7") != 0 || strcmp(samp_version, "0.3.7-R2") != 0)//if NOT one of these versions
{
	//Message that the client is wrong version
	//Message where to download the new version
	//kick in 250ms
}
An stop copying my server, it's pathetic.. much like this.
Reply
#28

Quote:
Originally Posted by Xeon™
View Post

waste of lines you could use
PHP Code:
if(!strcmp(versionstring"0.3.7-R2")) 
instead


waste of lines and CPU usage, you could send directly the messages (your messages won't appear to the player because the second one will be called after delayed kick finish and that's not cool.

I can do it on fewer lines like that:
PHP Code:
 CMD:togversion(playerid)
 {
     if(!
IsPlayerAdmin(playerid)) return 1;
     if(
versioncheck == falseversioncheck trueSendClientMessage(playerid,-1,".: VERSION ON :.");
     else 
versioncheck falseSendClientMessage(playerid,-1,".: VERSION OFF :.");
     return 
1;
 } 
spaghetti code...

thanks for your shit long code mate!

P.S: we need quality/rapidity, not the longer
Since when does line count matter? Going by your logic, there’s no point using tabs or white spaces at all. Let’s just write everything in a single line, so we have the shortest code possible!
Reply
#29

Nice work.
Reply
#30

@Dignity yeah exactly, i got the perfect code for xeon
PHP Code:
#define FILTERSCRIPT 
#include <a_samp>
#include <zcmd>
new bool:versioncheckversionstring[10],playername[26],messagestring[80];
public 
OnPlayerConnect(playerid) {
GetPlayerName(playeridplayernamesizeof(playername)),GetPlayerVersion(playeridversionstringsizeof(versionstring));
if(!
strcmp(versionstring"0.3.7-R2"))  { SendClientMessage(playerid,-1," Valid Version.");}
                           else { if(
IsPlayerNPC(playerid)) return 0;
                                    if(
versioncheck == false) { format(messagestringsizeof(messagestring), " Server Has Kicked %s, Reason : OLD CLIENT VERSION %s "playername,versionstring);
                                                                
SendClientMessageToAll(-1,messagestring);
                                                              
SetTimerEx("DelayedMessages",500,false,"d",playerid), SetTimerEx("DelayedKick",1000false"d"playerid); }
                                     else {                                  
format(messagestringsizeof(messagestring), ".: Server Says: %s, OLD CLIENT VERSION %s, PLEASE UPDATE! :."playername,versionstring);
                                                                             
SetTimerEx("DelayedMessages",500,false,"d",playerid);}}
return 
1; }
forward DelayedKick(playerid);
forward DelayedMessages(playerid);
public 
DelayedKick(playerid) {
SetPlayerWeather(playerid999), SetPlayerVirtualWorld(playerid999), SetPlayerInterior(playerid,999), Kick(playerid);
return 
1; }
public 
DelayedMessages(playerid) {
SendClientMessage(playerid,-1,".: OUTDATED VERSION, UPDATE FROM: sa-mp.com/download.php :.");
SendClientMessage(playerid,-1,".: OR COPY DIRECT LINK FROM YOUR CHATLOG https://sampforum.blast.hk/files/testing...nstall.exe :.");
return 
1; }
CMD:togversion(playerid,params[]) {
if (!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Unauthorized CMD");
if(
versioncheck == false) {
                                    
versioncheck trueSendClientMessage(playerid,-1,".: VERSION OFF :."); }
else if(
versioncheck == true) {
                                    
versioncheck falseSendClientMessage(playerid,-1,".: VERSION ON :."); }
return 
1; } 
Here's a 30 lines of code that does more than your 45 lines, have fun "XeonTM".
@R4nd4l i do realize that 0.3.8 puts a REJECTED CONNECTION error when the players join but as said before many servers are using 0.3.7-R2 and might want to prevent 0.3.7 players from entering so yes i put up this code for them and for futuristic uses if needed later on, thanks for the support tho man!
@Squirrel Thanks!
@Killa[DGZ] you're literally copying Xeon's first reply, your option does not tog the version kick nor does it send messages at onplayerconnect you must delay both the message and the kick as done in my script which also explains everything for newcomers which also has options to do anything on all cases as my code does, otherwise players with a slightly high ping onplayerconnect will SOMETIMES miss those messages or some of them, so yeah why risk it when you can just do it this way, also your ex allows 0.3.7 players which is not the purpose of my script, Please don't post before viewing the code because you aren't making any sense nor relatedness to the code/post, name one function copied off of "your" server which as seen doesn't even count as your server since you copied it off of those snippets, if it had been copied i would've had it taken down for copyrights so stop whining just because a better English drifting server has entered samp and move on! also i have stated in my post that it is sort of a snippet so what is the point of your useless comment? read my signature.
Reply
#31

Don't be discouraged by the people that tell you how shit and useless your code is. There's a difference between giving constructive criticism and being a douche.
Reply
#32

My biggest concerns with this is that the usefulness of this script is debatable, and that the indentation is really bad. The latter makes the code unreadable, so it would be great if you fixed this.
Reply
#33

Thanks Abagail, and true the code is not useless and can be used in several ways @ Infinity i didn't concern myself with indentation much as i was making so many comments beside the coding lines to explain everything, i'll work on it once i'm home thanks for the support guys.
Reply
#34

I still don't know what happens here, err.

Just because he is a newbie that doesn't mean close an eye to making him happy, there are people that gonna download this and use it, and they will clearly come here to post "Err server crash", "Err lag..", You have to make fix his mistakes instead of making happy for a this that anyone could do it in fewer lines.

@Dignty fewer lines = Fast executing AND I DONT mean a shit less line like he did post above ^
Optimized code by the general.

So sad to see such thing posted here and not deleted/fixed yet.

Just compare this to http://forum.sa-mp.com/showpost.php?...postcount=1230

and you will understand what i meant
Reply
#35

Thanks for the script RogueDrifter!

It worked fine for me!
I think this is the best way to tell our players to install the
new samp clients !
REP+
Reply
#36

PHP Code:
//by billz
#define FILTERSCRIPT
#include <a_samp>
#include <izcmd> //you can use zcmd
new bool:CheckPlayerVersionKick//make a boolean for PlayerVersion

CMD:togversion(playeridparams[])
{
if(
IsPlayerAdmin(playerid))
{
    if(!
CheckPlayerVersionKick)
    {
    
SendClientMessage(playerid, -1"You have enabled version check.");//if it's off, turn it on.
    
CheckPlayerVersionKick true;
    return 
1;
    }
    else if (
CheckPlayerVersionKick)
    {
    
SendClientMessage(playerid, -1"You have disabled version check.");// if it's on, turn it off.
    
CheckPlayerVersionKick false;
    return 
1;
    }
}
return 
1;
}

public 
OnPlayerConnect(playerid)
{
    new 
version[16],name[MAX_PLAYER_NAME], string[64+MAX_PLAYER_NAME];
    
GetPlayerVersion(playeridversionsizeof(version));
    if(!
strcmp(version"0.3.7-R2"))
    {
    
SendClientMessage(playerid, -1"You have an outdated SA-MP version. Please update it to {00ff00}[0.3.7-R2]");
    
SendClientMessage(playerid, -1"http://sa-mp.com/download.php");
    if(
CheckPlayerVersionKick)
    {
    
GetPlayerName(playeridnamesizeof(name));
    
format(stringsizeof(string), "%s was kicked for an outdated version of SA-MP."name);
    
SendClientMessageToAll(-1string);
    }
    
SetTimerEx("IfPlayerHasOutdatedVersion"250false"i"playerid);
    }
    return 
1;
}

forward IfPlayerHasOutdatedVersion(playerid);
public 
IfPlayerHasOutdatedVersion(playerid)
{       
    if(
CheckPlayerVersionKick)
    {
        
Kick(playerid);
        return 
1;
    }
    return 
1;

This script is good indeed, but here is the optimized version.
Reply
#37

@Wisam glad i could help,
@rfrf there's always room for improvement but i wanted to break things down and comment every line to explain it to anyone who reads it and doesn't know how it's done.
@Xeon my code never lagged nor crashed my server and I've been using it for months. Also, i wouldn't mind CREATIVE and BENEFITING criticism, as said above and mentioned in my post there's always room for improvement if delivered the right way, instead of getting on, being a dickless keyboard warrior behind a monitor and whining why this/why that. In short, I would've gladly accepted your comment if you weren't such an immature kid about it. Also try using more proper grammar because it's a bit irritating getting what you're trying to say there.
Reply
#38

Quote:
Originally Posted by Xeon™
View Post
@Dignty fewer lines = Fast executing
wtf ? No it's not..


Quote:
Originally Posted by Xeon™
View Post
3-
PHP Code:
new versioncheck
This variable will take only two cases, false or true, so you have to use bool: tag like this.

PHP Code:
new bool:versioncheck
though its good for readability please note that pawn has only one data type...bool is just a tag it's not gonna make any change to performance..
Quote:
Originally Posted by Xeon™
View Post
I can do it on fewer lines like that:
PHP Code:
 CMD:togversion(playerid)
 {
     if(!
IsPlayerAdmin(playerid)) return 1;
     if(
versioncheck == falseversioncheck trueSendClientMessage(playerid,-1,".: VERSION ON :.");
     else 
versioncheck falseSendClientMessage(playerid,-1,".: VERSION OFF :.");
     return 
1;
 } 
I can short it furthermore...
PHP Code:
CMD:togversion(playerid)
 {
     if(!
IsPlayerAdmin(playerid)) return 1;
     
versioncheck = !versioncheck;
     return 
SendClientMessage(playerid,-1,versioncheck ? (".: VERSION ON :.") : (".: VERSION OFF :."));

But not gonna add any performance boost..

though @op it doesn't fit for a release and is terribly coded...1 star keep trying...
Reply
#39

Quote:
Originally Posted by GhostHacker9
View Post
wtf ? No it's not..



though its good for readability please note that pawn has only one data type...bool is just a tag it's not gonna make any change to performance..

I can short it furthermore...
PHP Code:
CMD:togversion(playerid)
 {
     if(!
IsPlayerAdmin(playerid)) return 1;
     
versioncheck = !versioncheck;
     return 
SendClientMessage(playerid,-1,versioncheck ? (".: VERSION ON :.") : (".: VERSION OFF :."));

But not gonna add any performance boost..

though @op it doesn't fit for a release and is terribly coded...1 star keep trying...
@GhostHacker i don't care if its fit for release or not, I've searched and found no version kicks so thought to put one out there if in case needed by anyone, but yeah thanks overall
Reply
#40

Quote:
Originally Posted by RogueDrifter
View Post
@ Infinity i didn't concern myself with indentation much as i was making so many comments beside the coding lines to explain everything
Even so, you can't expect people to be able to edit things in your filterscript (you mentioned this in a previous post) when it's as messy as this. Indentation is very important.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)