SA-MP Forums Archive
help dcmd_setadmin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help dcmd_setadmin (/showthread.php?tid=91271)



help dcmd_setadmin - The_Tough - 13.08.2009

Hey i got a problem with my dudb..I dont know how to use the dcmd_setadmin ==> about how to save the players level and I need a hand here

enumaration..

Код:
enum PlayerInfo
{
	Level,
	Banned,
	Muted
};
new PlayerData[MAX_PLAYERS][PlayerInfo];
// dcmd

Код:
dcmd_setadmin(playerid,params[]) {
	if(PlayerData[playerid][Level] == 3)
  {
  new tmp[256],idx;
  tmp = strtok(params,idx);
  if(!strlen(tmp))
 	{
	  	return SystemMsg(playerid,"Usage: /setadmin <playerid> <level 1-3>");
  }
  new id = strval(tmp);
  if(!IsPlayerConnected(id))
  {
  	return SystemMsg(playerid,"Incorrect player !");
  }
  new level = strval(tmp);
  if(level > 4)
  {
  	return SystemMsg(playerid,"Error: Maximum level - 3");
  }
  new string[256], pname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pname,sizeof(pname));
  GetPlayerName(playerid,adminname,sizeof(adminname));
  format(string,sizeof(string),"[ ! ]===> %s has made you an administrator level %d)",adminname,level);
  SendClientMessage(id,COLOUR_RED,string);
  format(string,sizeof(string),"You made %s level admin %d",pname,level);
  SendClientMessage(playerid,COLOUR_RED,string);
  dUserSetINT(PlayerName(id)).("level",PlayerData[playerid][Level]);
  return true;
  }
  return 1;
}
// on disconnect

Код:
public OnPlayerDisconnect(playerid, reason)
{
	if (PLAYERLIST_authed[playerid]) {
  dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
 }
	PLAYERLIST_authed[playerid]=false;
 	return false;
}



Re: help dcmd_setadmin - saiberfun - 13.08.2009

hmm i dunno about dubd tho but i can see that if u do
if(level > 4)
it will be maxlvl 4 :P
do
if(level >= 4) :P
this means if its qual to 4 and higher

urs means if its higher than four means every that equals5 and higher^^


Re: help dcmd_setadmin - dice7 - 13.08.2009

Try
pawn Код:
dUserSetINT(PlayerName(id)).("level",dUserINT(PlayerName(playerid)).PlayerData[playerid][Level]);
Also, use dini, It's easier


Re: help dcmd_setadmin - The_Tough - 13.08.2009

ok I will try with dini,thanks



Re: help dcmd_setadmin - [LSB]Clinz - 14.08.2009

If you want to try dudb again, just set the player's admin level via that command then save it OnPlayerDisconnect, like this:

Код:
dUserSetINT(PlayerName(playerid)).("AdminLevel", PlayerData[playerid][Level]);
Then make a /login command and load it there with:

Код:
PlayerData[playerid][Level] = (dUserINT(PlayerName(playerid)).("AdminLevel"));



Re: help dcmd_setadmin - The_Tough - 31.08.2009

Fixed already,thx for the help anyway,Im using dini

PlayerData[playerid][Level] = dini_Int(file,"Level");