Код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
return 1;
}
-------------///////////////////////////-------------------///////////////////////////////-
I NEED THIS "INSERTED"
public OnPlayerConnect(playerid)
{//you will need to put the fexist to check if the player have registered before this
new INI:File = INI_Open(UserPath(playerid));//and put the shit below when the dialog shows instead checking a something that does not exist
if(PlayerInfo[playerid][pBanned] == 1) return Ban(playerid); //now he's REALLY banned!
else
{
//show your login dialog
}
return 1;
}
Код:
//-Admin System Commands
CMD:setlevel(playerid,params[])
{
new id,level;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Haley: {FF0000}You are not an RCON Administrator!");//send a message that the player is not logged in as RCON
if(sscanf(params,"ud",id,level) return SendClientMessage(playerid, -1, "Haley: {FF0000}The usage for this command is - /promote [NAME/ID] [LEVEL]"); {
if(level > 5) return SendClientMessage(playerid, -1, "Haley: Error 404! Your an idiot! You cant promote further than Level 5");
new INI:File = INI_Open(UserPath(id));//this is the example used in Kush's tut link above, make it fit in your system, note that i've changed the UserPath(playerid) to UserPath(id) to promote the chosen player not yourself
INI_WriteInt(File,"Admin",level); // writes the admin level in the ini file and makes the player admin.
INI_Close(File); //closes the ini file
return 1;
}
CMD:kick(playerid,params[])
{
new id,reason[128],name[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "Haley: {FF0000}You are not an admin or have insufficient perms!");
if(sscanf(params,"us[128]",id,reason); return SendClientMessage(playerid, -1, "Haley:{FF0000} Incorrect Usage! Use /kick [NAME/ID] [REASON] {
format(string1,sizeof(string1),"%s have been kicked from the server: reason: %s",GetPlayerName(id,name,sizeof(name)),reason); //this will format the kick message that is being sent to all player connected
SendClientMessageToAll(0xFFFFFF,string1);
SetTimerEx("DelayedKick", 1000, false, "d", playerid); // kicks the player but uses a timer so the message gets send
return 1;
}
CMD:ban(playerid,params[])
{
new id,reason[128],name[MAX_PLAYER_NAME];
if(!PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, -1 "Haley: {FF0000}You are not an admin or dont have sufficient perms!");
if(sscanf(params,"us[128]",id,reason); return SendClientMessage(playerid, -1, "Haley: {FF0000}Usage is incorrect! Use /ban [NAME/ID] [REASON]");
if(IsPlayerConnected(id))
{
format(string1,sizeof(string1),"%s have been banned from the server: reason: %s",GetPlayerName(id,name,sizeof(name)),reason); //this will format the kick message that is being sent to all player connected
SendClientMessageToAll(0xFFFFFF,string1);
Ban(id);//bans the player
}
else
{
new INI:File = INI_Open(UserPath(id));//this will just ban the name not the ip.
INI_WriteString(File,"Banned",1);//this is not written in the tut by Kush so we need to make it ourselves
INI_Close(File);
}
return 1;
}
//-End Admin System CMDS
///////////////////////////////----------------------------------------///////////////////////////////////////////////---------
ERRORS I RECIEVE
C:\Users\Alex-Minecraft\Videos\United Tokyo Drift\gamemodes\AdminUTD.pwn(201) : error 001: expected token: ")", but found "return"
C:\Users\Alex-Minecraft\Videos\United Tokyo Drift\gamemodes\AdminUTD.pwn(209) : warning 225: unreachable code
C:\Users\Alex-Minecraft\Videos\United Tokyo Drift\gamemodes\AdminUTD.pwn(209) : error 029: invalid expression, assumed zero
C:\Users\Alex-Minecraft\Videos\United Tokyo Drift\gamemodes\AdminUTD.pwn(209) : error 017: undefined symbol "cmd_kick"
C:\Users\Alex-Minecraft\Videos\United Tokyo Drift\gamemodes\AdminUTD.pwn(209) : error 029: invalid expression, assumed zero
C:\Users\Alex-Minecraft\Videos\United Tokyo Drift\gamemodes\AdminUTD.pwn(209) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
PHP код:
CMD:setlevel(playerid,params[])
{
new id,level;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Haley: {FF0000}You are not an RCON Administrator!");//send a message that the player is not logged in as RCON
if(sscanf(params,"ud",id,level) return SendClientMessage(playerid, -1, "Haley: {FF0000}The usage for this command is - /promote [NAME/ID] [LEVEL]");
if(level > 5) return SendClientMessage(playerid, -1, "Haley: Error 404! Your an idiot! You cant promote further than Level 5");
new INI:File = INI_Open(UserPath(id));//this is the example used in Kush's tut link above, make it fit in your system, note that i've changed the UserPath(playerid) to UserPath(id) to promote the chosen player not yourself
INI_WriteInt(File,"Admin",level); // writes the admin level in the ini file and makes the player admin.
INI_Close(File); //closes the ini file
return 1;
}