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 <=========== } }
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 <===========
}
}
//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;
}
Originally Posted by [MFC
Sylar [[::TheMafia::]] ]
I also need the automatic RCOn login code thanx |
public OnRconCommand(cmd[])
{
if(YourOwnAdminCode == 1)
{
//here something...
}
return 1;
}
SendRconCommand("login changeme");
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;} }
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;
}