SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 31/10/2019, 10:32 AM   #1
BreezeSAMP
Little Clucker
 
Join Date: Dec 2018
Location: Spain
Posts: 21
Reputation: 11
Question Only join SAMP R3 - SOLVED

Hello, I would like to know how I can make my players can only enter with SAMP R3 to my server, and if it is not so I do not let in, thanks.



(solved)

Last edited by BreezeSAMP; 01/11/2019 at 11:45 AM.
BreezeSAMP is offline   Reply With Quote
Old 31/10/2019, 10:52 AM   #2
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 363
Reputation: 17
Default Re: Only join SAMP R3

This may help:
https://wiki.sa-mp.com/wiki/GetPlayerVersion
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 31/10/2019, 11:18 AM   #3
BreezeSAMP
Little Clucker
 
Join Date: Dec 2018
Location: Spain
Posts: 21
Reputation: 11
Default Re: Only join SAMP R3

Quote:
Originally Posted by Proxus View Post
I know, but I can't get what I need, so I ask for the code, please.
BreezeSAMP is offline   Reply With Quote
Old 31/10/2019, 11:31 AM   #4
$Marco$
Huge Clucker
 
$Marco$'s Avatar
 
Join Date: Sep 2012
Location: GetPlayerPos(playerid)
Posts: 360
Reputation: 127
Default Re: Only join SAMP R3

There's an example code at the bottom of the Wiki, its not hard to code yourself.

PHP Code:
public OnPlayerConnect(playerid)
{
    new 
string[24];
    
GetPlayerVersion(playeridstringsizeof(string));
    
format(stringsizeof(string), "Your version of SA-MP: %s"string);
    
SendClientMessage(playerid0xFFFFFFFFstring);
    
// possible text: "Your version of SA-MP: 0.3.7"
    
return 1;

__________________
$Marco$ is offline   Reply With Quote
Old 31/10/2019, 11:37 AM   #5
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 363
Reputation: 17
Default Re: Only join SAMP R3

Code:
public OnPlayerConnect(playerid)
{
    new string[24];
    GetPlayerVersion(playerid, string, sizeof(string));
    if(strcmp(string, "0.3.7-R3", true)) return Kick(playerid); // i assume it's 0.3.7-R3, I could be wrong

    // allow player to login n stuff here
    return 1;
}
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 31/10/2019, 11:46 AM   #6
BreezeSAMP
Little Clucker
 
Join Date: Dec 2018
Location: Spain
Posts: 21
Reputation: 11
Default Re: Only join SAMP R3

Quote:
Originally Posted by Proxus View Post
Code:
public OnPlayerConnect(playerid)
{
    new string[24];
    GetPlayerVersion(playerid, string, sizeof(string));
    if(strcmp(string, "0.3.7-R3", true)) return Kick(playerid); // i assume it's 0.3.7-R3, I could be wrong

    // allow player to login n stuff here
    return 1;
}
I will try it.
BreezeSAMP is offline   Reply With Quote
Old 31/10/2019, 11:06 PM   #7
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,230
Reputation: 993
Default Re: Only join SAMP R3

Might want to show them a message explaining why they are being kicked...

Note that you have to delay Kick() by 0.5 seconds (500ms) or so after the message because the Kick() packet has priority and will take effect before the message gets displayed.
__________________
Click banner above for more info. View trailers here.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 31/10/2019, 11:25 PM   #8
Proxus
Huge Clucker
 
Proxus's Avatar
 
Join Date: May 2018
Location: United Kingdom
Posts: 363
Reputation: 17
Default Re: Only join SAMP R3

Quote:
Originally Posted by MP2 View Post
Might want to show them a message explaining why they are being kicked...

Note that you have to delay Kick() by 0.5 seconds (500ms) or so after the message because the Kick() packet has priority and will take effect before the message gets displayed.
Yeah, he can do that. I just left it at that for simplicity reasons. However, it may be more accurate to kick the player after different durations depending on his ping. Just to ensure that the player gets the message.
__________________
Developer @ Trucknation
Administrator & Developer @ Lost Legacy
"Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity"


IMPORTANT LINKS
Proxus is offline   Reply With Quote
Old 01/11/2019, 11:45 AM   #9
BreezeSAMP
Little Clucker
 
Join Date: Dec 2018
Location: Spain
Posts: 21
Reputation: 11
Default Re: Only join SAMP R3

Solved, thanks all.
BreezeSAMP 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
Samp Crashes right when i join a server gxmt Client Support 2 02/08/2015 10:36 PM
SAMP Crashes when i try to join a server UnknownPlayer Bug Reports 0 31/07/2015 10:29 PM
Can't join any samp servers hhaaoo123 Client Support 18 26/12/2014 12:42 AM
Can't join any samp server Speeeeeed Client Support 4 30/05/2013 03:46 PM
I have a BIG BUG then i start SAMP and join a server MrEnd Client Support 0 26/01/2010 10:30 PM


All times are GMT. The time now is 06:21 PM.


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