Need a help
#1

Here is the dini code

Код:
   if(!fexist(SettingFile))
  {
    dini_Create(SettingFile);
    dini_IntSet(SettingFile, "PocketMoney", 3000);
    dini_IntSet(SettingFile, "JailCommands", 0);
    dini_IntSet(SettingFile, "AnnounceSeconds", 5);
    dini_IntSet(SettingFile, "PASS_MIN", 2);
  	dini_IntSet(SettingFile, "PASS_MAX", 19);

  }

  gSettings[POCKET_MONEY]     = dini_Int(SettingFile, "PocketMoney");
  gSettings[JAIL_COMMANDS]     = dini_Int(SettingFile, "JailCommands");
  gSettings[ANNOUNCE_SECONDS]       = dini_Int(SettingFile, "AnnounceSeconds");
  gSettings[PASS_MIN]           = dini_Int(SettingFile, "PASS_MIN");
  gSettings[PASS_MAX]           = dini_Int(SettingFile, "PASS_MAX");
  
  if(!fexist(CommandFile))
  {
    dini_Create(CommandFile);
    dini_IntSet(CommandFile, "Akill", 1);
    dini_IntSet(CommandFile, "Announce", 1);
    dini_IntSet(CommandFile, "Armourall", 3);
    dini_IntSet(CommandFile, "Ban", 1);
    dini_IntSet(CommandFile, "Explode", 2);
    dini_IntSet(CommandFile, "Telmeto", 1);
    dini_IntSet(CommandFile, "Teltome", 2);
    dini_IntSet(CommandFile, "Givearmour", 2);
    dini_IntSet(CommandFile, "Givehealth", 1);
    dini_IntSet(CommandFile, "Giveweapon", 2);
    dini_IntSet(CommandFile, "God", 4);
    dini_IntSet(CommandFile, "Healall", 2);
    dini_IntSet(CommandFile, "Imitate", 3);
    dini_IntSet(CommandFile, "Ip", 1);
    dini_IntSet(CommandFile, "Kick", 1);
    dini_IntSet(CommandFile, "Ping", 1);
    dini_IntSet(CommandFile, "Setlevel", 4);
    dini_IntSet(CommandFile, "Time", 2);
    dini_IntSet(CommandFile, "Weather", 1);
    dini_IntSet(CommandFile, "Force", 1);
    }

  gCommands[AKILL]       = dini_Int(CommandFile, "Akill");
  gCommands[ANNOUNCE]        	= dini_Int(CommandFile, "Announce");
  gCommands[BAN]         = dini_Int(CommandFile, "Ban");
  gCommands[EXPLODE]       = dini_Int(CommandFile, "Explode");
  gCommands[TELMETO]       = dini_Int(CommandFile, "Telmeto");
  gCommands[TELTOME]       = dini_Int(CommandFile, "Teltome");
  gCommands[GIVEARMOUR]       = dini_Int(CommandFile, "Givearmour");
  gCommands[GIVEHEALTH]       = dini_Int(CommandFile, "Givehealth");
  gCommands[GIVEWEAPON]       = dini_Int(CommandFile, "Giveweapon");
  gCommands[HEALALL]       = dini_Int(CommandFile, "Healall");
  gCommands[IMITATE]       = dini_Int(CommandFile, "Imitate");
  gCommands[IP]         = dini_Int(CommandFile, "Ip");
  gCommands[KICK]       = dini_Int(CommandFile, "Kick");
  gCommands[SETLEVEL]       = dini_Int(CommandFile, "Setlevel");
  gCommands[BAN]       = dini_Int(CommandFile, "Ban");
  gCommands[TIME]       = dini_Int(CommandFile, "Time");
  gCommands[WEATHER]       = dini_Int(CommandFile, "Weather");
  gCommands[FORCE]      = dini_Int(CommandFile, "Force");
  return 1;
  }
}
onplayerconnect

Код:
new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
	if(!dini_Exists(file)) {
		dini_Create(file);
		dini_Set(file,"Name",Name);
		dini_Set(file,"Ip",Ip);
		dini_IntSet(file,"Registered",-1);
		dini_IntSet(file,"Password",0);
		dini_IntSet(file,"Level",0);
		dini_IntSet(file,"Wired",0);
		dini_IntSet(file,"Jailed",0);
		SendClientMessage(playerid,COLOUR_ORANGE,"You're username is not recognized on this server. Please /register to continue.");
	}
	strcat(gPlayerInfo[playerid][PLAYER_NAME],			dini_Get(file,"Name"));
	strcat(gPlayerInfo[playerid][PLAYER_IP],			dini_Get(file,"Ip"));
	gPlayerInfo[playerid][PLAYER_REGGED] 			   = dini_Int(file,"Registered");
	gPlayerInfo[playerid][PLAYER_PASS]              = dini_Int(file,"Password");
	gPlayerInfo[playerid][PLAYER_LEVEL] 			   = dini_Int(file,"Level");
	gPlayerInfo[playerid][PLAYER_WIRED]              = dini_Int(file,"Wired");
	gPlayerInfo[playerid][PLAYER_JAILED] 			   = dini_Int(file,"Jailed");
	if(gPlayerInfo[playerid][PLAYER_REGGED] == 0) 	        SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server, but you have not registered. Please /register to continue.");
	else if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)       SendClientMessage(playerid,COLOUR_ORANGE,"You're username is recognised on this server. Please /login to continue.");
 	gPlayerInfo[playerid][PLAYER_REGGED]             = 0;
	return 1;
}
onplayerdisconnect
Код:
	new file[100];
  format(file,sizeof(file),PlayerFile,gPlayerInfo[playerid][PLAYER_NAME]);
  dini_Set(file,"Name",gPlayerInfo[playerid][PLAYER_NAME]);
  dini_Set(file,"Ip",gPlayerInfo[playerid][PLAYER_IP]);
  dini_IntSet(file,"Registered",gPlayerInfo[playerid][PLAYER_REGGED]);
  dini_IntSet(file,"Password",gPlayerInfo[playerid][PLAYER_PASS]);
  dini_IntSet(file,"Level",gPlayerInfo[playerid][PLAYER_LEVEL]);
  dini_IntSet(file,"Wired",gPlayerInfo[playerid][PLAYER_WIRED]);
  dini_IntSet(file,"Jailed",gPlayerInfo[playerid][PLAYER_JAILED]);
  gPlayerInfo[playerid][PLAYER_NAME]  = 0;
  gPlayerInfo[playerid][PLAYER_IP]   = 0;
  gPlayerInfo[playerid][PLAYER_REGGED] = 0;
  gPlayerInfo[playerid][PLAYER_LOGGED] = 0;
  gPlayerInfo[playerid][PLAYER_LEVEL] = 0;
  gPlayerInfo[playerid][PLAYER_WIRED] = 0;
  gPlayerInfo[playerid][PLAYER_JAILED] = 0;
	return 1;
admin commands
Код:
dcmd_akill(playerid, params[])
  if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[AKILL])
  {
    new string[100];
    format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[AKILL]);
    return SendClientMessage(playerid, COLOUR_ORANGE, string);
  }
  else if(!strlen(params))
    return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /akill [id | name]");
  else
  {
	new id = (IsNumeric(params)) ? strval(params) : GetPlayerId(params);
	if(IsPlayerConnected(id) && id != playerid)
	{
	  SetPlayerHealth(id, 0.0);
	  new string[150];
	  format(string, sizeof(string), "You have been admin-killed by administrator \'%s\'.", gPlayerInfo[playerid][PLAYER_NAME]);
	  SendClientMessage(id, COLOUR_ORANGE, string);
	  format(string, sizeof(string), "You have successfully admin-killed player \'%s\'.", gPlayerInfo[id][PLAYER_NAME]);
	  return SendClientMessage(playerid, COLOUR_LIGHTBLUE, string);
	}
	else
	  return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You can not admin-kill yourself or a disconnected player.");
 		}

dcmd_announce(playerid, params[])
  if(gPlayerInfo[playerid][PLAYER_LEVEL] < gCommands[ANNOUNCE])
  {
    new string[100];
    format(string, sizeof(string), "You must be administrator level %d to use that command!", gCommands[ANNOUNCE]);
    return SendClientMessage(playerid, COLOUR_ORANGE, string);
	}
  else if(!strlen(params))
    return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /announce [message]");
	else
		return GameTextForAll(params, gSettings[ANNOUNCE_SECONDS] * 30000, 5);
I dont understand why when Im registering and the quiting+joining again I have to recreate the account while the file of the player exists on the AdminScript/users/%s.ini

it has this in it
Код:
Name=The_Tough
Ip=10.0.0.1
Registered=-1
Password=0
Level=0
Wired=0
Jailed=0
and I dont understand why every single player can use the admin commands,it supposed to be used by the level,any help would be apriciated ..

"Error on compiling is just a waring of loosing indentation" nothing else
Reply
#2

loose indention's can cause other things to not work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)