02.10.2013, 16:06
Hi. I would like to add if a Admin or VIP join the server. It will be like this:
"Admin Level 5 - Cocomber (ID:2) has been joined the server" <<-- For admin
"VIP Level 3 - Bibingka (ID:5) has been joined the server" << -- For VIP
this is my onplayerconnect
"Admin Level 5 - Cocomber (ID:2) has been joined the server" <<-- For admin
"VIP Level 3 - Bibingka (ID:5) has been joined the server" << -- For VIP
this is my onplayerconnect
Код:
public OnPlayerConnect(playerid) { SetPVarInt(playerid, "GotoEnabled", 1); //Go Check SetPVarInt(playerid, "PMEnabled",1); SetPVarInt(playerid, "GodMode", 0); //God mode Check ClearWeapons(playerid); //godmode SendDeathMessage(INVALID_PLAYER_ID,playerid, 200); SetTimerEx("VRepair",500,true,"i",playerid); if(IsPlayerNPC(playerid)) return 1; #if SpecTextDraw == true CreateSpecTD(playerid); #endif new Jfile[100],pIP[16],Jstr[128]; strdel(aka,0,256); GetPlayerIp(playerid,pIP,16); GetPlayerIp(playerid,playerIP,16); format(Jfile,sizeof(Jfile),"JLadmin/Logs/aka.ini"); INI_ParseFile(Jfile,"GetAkaLog"); ResetVariables(playerid); if(strlen(aka) < 3) { format(Jfile,sizeof(Jfile),"JLadmin/Logs/aka.ini"); new INI:AKA = INI_Open(Jfile); INI_WriteString(AKA, pIP, GetName(playerid)); INI_Close(AKA); } else if(strfind(aka, GetName(playerid), true) == -1) { format(Jfile,sizeof(Jfile),"JLadmin/Logs/aka.ini"); format(Jstr,sizeof(Jstr),"%s,%s", aka, GetName(playerid)); new INI:AKA = INI_Open(Jfile); INI_WriteString(AKA, pIP, Jstr); INI_Close(AKA); } if(strlen(aka) > 70) { strmid(Jstring,aka,0,70); format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: %s", GetName(playerid),playerIP , Jstring); SendToAdmins(Cmdcolor,Jstr); strmid(Jstring,aka,70,sizeof(aka)); format(Jstr, sizeof(Jstr),"%s", Jstring); SendToAdmins(Cmdcolor,Jstr); } else { if(strlen(aka) > 2) format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: %s", GetName(playerid),playerIP , aka); else format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: No aka found!", GetName(playerid),playerIP); SendToAdmins(Cmdcolor,Jstr); } format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid)); if(!fexist(Jfile)) { format(Jstring, sizeof(Jstring),"Nickname \"%s\" isn't registered. Please register your nick name to save your status\nEnter the password:", GetName(playerid)); if(MustRegister == 1) ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register an account!", Jstring, "Register", "Kick"); SendClientMessage(playerid,red,">> You are not yet registered. Please register to save your status"); SendClientMessage(playerid, white,">> Please register to create an account {ffd700}/register"); } else { pInfo[playerid][Registered] = 1; format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid)); INI_ParseFile(Jfile, "GetPlayerInfo", .bExtra = true, .extra = playerid); if(AutoLogin == 1 && (!strcmp(pIP, pInfo[playerid][IP],true) && pInfo[playerid][pAutoLogin] == 1)) { format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid)); INI_ParseFile(Jfile, "LoginPlayer", .bExtra = true, .extra = playerid); SetPlayerScore(playerid, pInfo[playerid][Score]); GivePlayerMoney(playerid, pInfo[playerid][Cash]); pInfo[playerid][Logged] = 1; if(pInfo[playerid][pLevel] >= 1) { switch(pInfo[playerid][pLevel]) { case 1: LevelName = ADMIN_LEVEL_1; case 2: LevelName = ADMIN_LEVEL_2; case 3: LevelName = ADMIN_LEVEL_4; case 4: LevelName = ADMIN_LEVEL_3; case 5: LevelName = ADMIN_LEVEL_5; default: LevelName = ADMIN_LEVEL_6; } format(Jstring, sizeof(Jstring),">> Welcome back, You have been automatically logged in! | Level: %d (%s)", pInfo[playerid][pLevel], LevelName); SendClientMessage(playerid,lighterblue,Jstring); } else SendClientMessage(playerid,lighterblue,">> Welcome back, You have been automatically logged in"); } else { #if LoginTextDraw == false format(Jstring, sizeof(Jstring),"Nickname \"%s\" registered.\nPlease enter your password to login", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Account Login", Jstring, "Login", "Quit"); #endif SendClientMessage(playerid,lighterblue,">> This name is registered to the server"); SendClientMessage(playerid,red,">> Please /login access your account"); } } if(ForbiddenNamesKick == 1 && IsForbiddenNick(playerid) == 1) { format(Jstring, sizeof(Jstring),"{FB0404}Your nickname \"%s\" is in blacklist. Please relog\nwith a new nickname", GetName(playerid)); ShowPlayerDialog(playerid, JDIALOGS+45, DIALOG_STYLE_MSGBOX," {FB0404}Forbidden nick", Jstring, "Close", ""); SetTimerEx("KickPlayer",200,false,"d", playerid); format(Jstring, sizeof(Jstring),">> \"%s\" has been automatically kicked | Reason: Forbidden Name", GetName(playerid)); SendToAdmins(orange,Jstring); WriteToLog(Jstring,"KickLog"); } if(KickPartNicks == 1 && IsBadNickPart(playerid) == 1) { format(Jstring, sizeof(Jstring),">> {FB0404}Your nick name part \"%s\" is in Forbidden part nick names list.\nplease relog with a new nick name", BadNickParts[BadPartID]); ShowPlayerDialog(playerid, JDIALOGS+45, DIALOG_STYLE_MSGBOX," {FB0404}Forbidden part nick", Jstring, "Close", ""); SetTimerEx("KickPlayer",200,false,"d", playerid); format(Jstring, sizeof(Jstring),">> \"%s\" has been automatically kicked | reason: 'Forbidden part nick (%s)'", GetName(playerid),BadNickParts[BadPartID]); SendToAdmins(orange,Jstring); WriteToLog(Jstring,"KickLog"); } return 1; }