SA-MP Forums Archive
if (name[playerid] == Remi)? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: if (name[playerid] == Remi)? (/showthread.php?tid=71184)



if (name[playerid] == Remi)? - Remi-X - 30.03.2009

Is it possible to make a script in On Player Connect, wich do something like this:
You join the server, and the server checks if i am Remi. If i'm Remi, i can login. If i'm not Remi, i wil be kicked from the the server.

Is that possible? And how?


Re: if (name[playerid] == Remi)? - FUNExtreme - 30.03.2009

if(GetPlayerName[playerid] == Remi)


Re: if (name[playerid] == Remi)? - Pyrokid - 30.03.2009

pawn Код:
new string[16];
    GetPlayerName(playerid,string,MAX_PLAYER_NAME);
    if((strfind(string, "Remi", true) != -1))
    {
        SendClientMessage(playerid, color, "Welcome");
    } else {
        Kick(playerid);
    }



Re: if (name[playerid] == Remi)? - Dujma - 30.03.2009

Quote:
Originally Posted by FUNExtreme
if(GetPlayerName[playerid] == Remi)
A?

Quote:
Originally Posted by Pyrokid
pawn Код:
new string[16];
    GetPlayerName(playerid,string,MAX_PLAYER_NAME);
    if((strfind(string, "Remi", true) != -1))
    {
        SendClientMessage(playerid, color, "Welcome");
    } else {
        Kick(playerid);
    }
Than if someone enter the server with name Remi_Lastname the server will not kick him...


Re: if (name[playerid] == Remi)? - Pyrokid - 30.03.2009

So the -1 should be 4 right?

Still anyone can change their name to Remi and join. You should use your IP instead.


Re: if (name[playerid] == Remi)? - Norn - 30.03.2009

Quote:
Originally Posted by FUNExtreme
if(GetPlayerName[playerid] == Remi)
Don't attempt to help people if you don't even know the correct answer.


Re: if (name[playerid] == Remi)? - Remi-X - 30.03.2009

so what must i use?
Код:
	new string[16];
	GetPlayerName(playerid,string,MAX_PLAYER_NAME);
	if((strfind(string, "Remi", true) != 4))
	{
		SendClientMessage(playerid, color, "Welcome");
	} else {
		Kick(playerid);
	}
?


Re: if (name[playerid] == Remi)? - Pyrokid - 30.03.2009

Quote:
Originally Posted by Remi-X
so what must i use?
Код:
	new string[16];
	GetPlayerName(playerid,string,MAX_PLAYER_NAME);
	if((strfind(string, "Remi", true) != 4))
	{
		SendClientMessage(playerid, color, "Welcome");
	} else {
		Kick(playerid);
	}
?
Yeah I think that should work (someone confirm it for me).

However like I said before, if you're not in the server and it is up, a random person can just change their name to Remi and join. It'd be best if you checked the IP address.

OnPlayerConnect
pawn Код:
new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));

    if (!strcmp(ip, "change this to your IP")) {
      SendClientMessage(playerid, 0xFFFFFFFF, "- Welcome to your server master :-).");
    } else {
        Kick(playerid);
    }
Get your IP here: http://www.whatismyip.com/


Re: if (name[playerid] == Remi)? - Remi-X - 30.03.2009

Quote:
Originally Posted by Pyrokid
OnPlayerConnect
pawn Код:
new ip[16];
    GetPlayerIp(playerid, ip, sizeof(ip));

    if (!strcmp(ip, "change this to your IP")) {
      SendClientMessage(playerid, 0xFFFFFFFF, "- Welcome to your server master :-).");
    } else {
        Kick(playerid);
    }
Get your IP here: http://www.whatismyip.com/
Yes, i know about the IP Adress. But i'm making a meeting for the Dutch GTAForum.nl, and some peple there have a changing IP, not a static. So, for this time is a name more handy. But, im not stupid. If the name is valid, you must login after that. So, if someone have the same name, he even cant get in the server because he dont know the pass.

But thanks


Re: if (name[playerid] == Remi)? - Pyrokid - 30.03.2009

K then the name one I posted should work, although you should test it.