Need an if !
#1

Hello everybody, I need this if:


if(IsPlayerName(playerid, name);{ }

And it should work like this:

Код:
public OnPlayerConnect(playerid)
{
new: name
name = [MFC]Sylar || [SWAT]fazox

  if(IsPlayerName(playerid, name) || !IsPlayerLoggedIn(playerid, true)) ;
  {
   =============> Here should be an /rcon login PASSWORD command <===========
  }
}
Thank you

Reply
#2

GetPlayerName, strcmp..
Reply
#3

Try something like this..
pawn Код:
public OnPlayerConnect(playerid)
{
  new name[24];
  GetPlayerName(playerid,name,24);
  if(strcmp(name,"[MFC]Sylar",true) == 0 || strcmp(name,"[SWAT]fazox",true) == 0 || !IsPlayerLoggedIn(playerid, true))
  {
   =============> Here should be an /rcon login PASSWORD command <===========
  }
}
Reply
#4

pawn Код:
//place outside of any callbacks, most commonly on the top below #includes
IsPlayerName(playerid,name[])
{
  new tmp[MAX_PLAYER_NAME];
  GetPlayerName(playerid,tmp,sizeof(tmp));
  if(!strcmp(tmp,name,false))return 1;
  return 0;
}

//use
public OnPlayerConnect(playerid)
{
  if(IsPlayerName(playerid,"[BaD]AssMcGee"))
  {
    SendClientMessage(playerid,0xFF0000FF,"YOU'RE FAT!");
  }
  return 1;
}
There you go, untested.
Reply
#5

I also need the automatic RCOn login code

thanx
Reply
#6

Quote:
Originally Posted by [MFC
Sylar [[::TheMafia::]] ]
I also need the automatic RCOn login code

thanx
I think you cant do it. But MAYBE you can do your own admin system and combine it with this

pawn Код:
public OnRconCommand(cmd[])
{
    if(YourOwnAdminCode == 1)
    {
        //here something...
    }
    return 1;
}

EDIT<----------------

Also there is that function.
SendRconCommand
I wish you could make something like
pawn Код:
SendRconCommand("login changeme");
Reply
#7

No, SendRCONcommand and Login, would be for logging the GM

but i Think there is a command.. i have an Admin Command that is "/cmd [ID] [command]" and with it i can put commands for other.. so i thought when i connect if my name is X, then it would be something like that, becouse i tested it and it worked ( /cmd 1 /rcon login changeme)

Here's the code:
Код:
	if(strcmp(cmd,"/cmd",true)==0)
	{
  if(IsPlayerAdmin(playerid)){
		tmp = strtok(cmdtext, idx);
		new otherplayer = ReturnUser(tmp);
		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cmd [playerid] [command]");
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cmd [playerid][command]");
		if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid,COLOR_WHITE, "Invalid ID.");
		SendRaw(otherplayer, result);
		return 1;}
	}
Credits go for V-Admin creator :P
Reply
#8

pawn Код:
forward IsPlayerName(playerid,name[],iscasesensitive);
public IsPlayerName(playerid,name[],iscasesensitive)
{
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  if(iscasesensitive) { return strcmp(pName,name,true)? 0 : 1; }
  if(!iscasesensitive) { return strcmp(pName,name,false)? 0 : 1; }
  return 0;
}
There you go... UNTESTED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)