admin command weird? -
Mustafa6155 - 11.12.2012
pawn Код:
CMD:setlevel(playerid,params[])
{
new id,level;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid,-1,"{F81414}[USAGE]: /setlevel [playerid/name] [level]");
else
{
if(level > 10) return SendClientMessage(playerid, -1,"{F81414}Only 1-10 levels allowed!");
else
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"RCON Administrator promoted %s to administrator!",pName);
SendClientMessageToAll(-1,string);
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Admin",level);
INI_Close(File);
}
}
}
else
{
return 1;
}
return 1;
}
pawn Код:
enum pInfo
{
pPass,
pGeld,
pAdmin,
pMoorden,
pScore,
pDoden,
pBommen,
pLevel,
pVip,
pWarns,
pBanned,
pMuted,
pLoggedin
}
This is my enum
pawn Код:
INI_WriteInt(File,"Admin",level);
INI_Close(File);
New Writing something new With Admin.
PHP код:
Admin = 5 //then its writing new hot to fix deleting this!
[data]
Password = 248578818
Geld = 0
Admin = 1338 //but its making this??
Moorden = 1
Score = 0
Doden = 5
Bommen = 0
Level = 0
Vip = 0
Re: admin command weird? -
[HK]Ryder[AN] - 11.12.2012
so you want it to be like
pawn Код:
[data]
Password = 248578818
Geld = 0
Admin = 1338 //but its making this??
Moorden = 1
Score = 0
Doden = 5
Bommen = 0
Level = 0
Vip = 0
and not like
pawn Код:
Admin = 5 //then its writing new hot to fix deleting this!
[data]
Password = 248578818
Geld = 0
Admin = 1338 //but its making this??
Moorden = 1
Score = 0
Doden = 5
Bommen = 0
Level = 0
Vip = 0
then change your command to this
pawn Код:
CMD:setlevel(playerid,params[])
{
new id,level;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid,-1,"{F81414}[USAGE]: /setlevel [playerid/name] [level]");
else
{
if(level > 10) return SendClientMessage(playerid, -1,"{F81414}Only 1-10 levels allowed!");
else
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"RCON Administrator promoted %s to administrator!",pName);
SendClientMessageToAll(-1,string);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(file, "data");
INI_WriteInt(File,"Admin",level);
INI_Close(File);
}
}
}
else
{
return 1;
}
return 1;
}
Re: admin command weird? -
Mustafa6155 - 11.12.2012
undefined file??
EDIT: fixed file must by File
When i do /setlevel as rcon i set to 1 and d /stats still show me old admins status Then i try doing ESC and startmenu going to scriptfiles its 1 but... then me admin commands work to.
And when i close me server and Gta open scriptfiles it stands 1338??
Re: admin command weird? -
Mustafa6155 - 11.12.2012
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""LIGHTBLAUW"Registeren",""ROOD"Je hebt de foude wachtwoord in getypt!\n"WIT"Type jouw eigen wachtwoord om te registeren!","Registerr","Verlaat");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Geld",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Moorden",0);
INI_WriteInt(File,"Score",10);
INI_WriteInt(File,"Doden",0);
INI_WriteInt(File,"Bommen",0);
INI_WriteInt(File,"Level",1);
INI_WriteInt(File,"Vip",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""WIT"Success!",""GROEN"Je bent succesvol registeert","Oke","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pGeld]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""GROEN"Sucess!",""GROEN"je bent succesvol ingelogt.","Oke","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WIT"Login",""ROOD"Je hebt de foude wachtwoord in gevuld!\n"WIT"Type je wachtwoord om in teloggen","Login","Verlaat");
}
return 1;
}
}
}
return 1;
}
Or this..
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Geld",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Moorden",PlayerInfo[playerid][pMoorden]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Doden",PlayerInfo[playerid][pDoden]);
INI_WriteInt(File,"Bommen",PlayerInfo[playerid][pBommen]);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_Close(File);
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s heeft de server verlaten.(Timeout/Crash)", pname);
case 1: format(string, sizeof(string), "%s heeft de server verlaten. (Leaving)", pname);
case 2: format(string, sizeof(string), "%s heeft de server verlaten. (Kicked/Banned)", pname);
}
SendClientMessageToAll(0x00ff94ff, string);
return 1;
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Geld",PlayerInfo[playerid][pGeld]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Moorden",PlayerInfo[playerid][pMoorden]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Doden",PlayerInfo[playerid][pDoden]);
INI_Int("Bommen",PlayerInfo[playerid][pBommen]);
INI_Int("Level",PlayerInfo[playerid][pLevel]);
INI_Int("Vips",PlayerInfo[playerid][pVip]);
return 1;
}
U mean this i dont get anything else??