[Help] /adsetlevel command
#1

Hi guys im currently with a problem here: idk how to make /adsetlevel after setting someones level save it to the dudb save file because i can change their admin level BUT it doesnt save when they reconnect.
Please help me if u can
Reply
#2

do you even have dudb? if so show me the enums
Reply
#3

Yea i do have it but idk what line to put so gamemode edits the player save on the Adminlevel line
Reply
#4

You need to add the admin level as a variable in the enum as suggested above, and then when the rest of them are written to file get it to write that variable as well on the disconnect call-back. Not sure how much sense that makes to you but it's hard to be specific when provided with very little information.
Reply
#5

Im a new scripter idk what u talking about D: sry BUT if u want more information here it is the adsetlevel command. What should i put?

dcmd_adsetlevel(playerid,params[])
{
new string[128];
new ID;
new cmdreason;
if(sscanf(params,"ui",ID,cmdreason))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /adsetlevel (Player Name/ID) (Level)");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"[ERROR] The player ID (%d) is not connected to the server. You cannot set their administrator level.",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(PLAYERLIST_authed[ID] != 1)
{
format(string,sizeof(string),"[ERROR] %s(%d) is not logged into to the server. You must wait till they login before you set their administrator level.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(AdminLevel[ID] == cmdreason)
{
format(string,sizeof(string),"[ERROR] %s(%d) is already at the Administrator level: %d",PlayerName(ID),ID,cmdreason);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,COLOR_ERROR,"[ERROR] You cannot set your own Administrator level. You are already the highest level.");
return 1;
}
new string1[128];
format(string1,sizeof(string1),"[ADMIN LEVEL CHANGE] Owner %s(%d) has given %s(%d) administrator level %d.",PlayerName(playerid),playerid,PlayerName(ID), ID,cmdreason);
SendClientMessageToAll(COLOR_ADMIN,string1);
dUserSet("Nickname").("Adminlevel ","%d");

SendClientMessage(ID,COLOR_ADMIN,"Your admin level has been changed by the Server Owner. To see your new commands type /adcmds.");
AdminLevel[ID] =cmdreason;

format(string,sizeof(string),"[ADMIN LEVEL CHANGE] Owner %s(%d) has given %s(%d) administrator level %d.",PlayerName(playerid),playerid,PlayerName(ID), ID,cmdreason);
IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
dUserSet("Nickname").("Adminlevel ","%d");
return 1;
}
Reply
#6

Plz guys help me!
Reply
#7

Please show us what code you've got under OnPlayerDisconnect if you can. That way we can address whether user files are being created whatsoever.
Reply
#8

public OnPlayerDisconnect(playerid, reason)
{
if(IsPlayerNPC(playerid))
{
IsSpawned[playerid] =0;
return 1;
}
if(afktag[playerid] == 1)
{
new pname[16];
GetPlayerName(playerid,pname,16);
strdel(pname, strlen(pname)-5, strlen(pname));
afktag[playerid] =0;
SetPlayerName(playerid,pname);
}
new string[128];
new pname[24];
GetPlayerName(playerid,pname,sizeof(pname));

//Save Wanted Level && Jailtime
SavedWantedLevel[playerid] =GetPlayerWantedLevel(playerid);
SavedJailTime[playerid] =JailTime[playerid];
SavedCash[playerid] =GetPlayerMoney(playerid);
new year,month,day;
getdate(year,month,day);
new lconnect[15];
if(PLAYERLIST_authed[playerid] == 1)
{
dUserSetINT(PlayerName(playerid)).("Bankcash",Bank Cash[playerid]);
dUserSetINT(PlayerName(playerid)).("Cash",SavedCas h[playerid]);
dUserSetINT(PlayerName(playerid)).("Score",GetPlay erScore(playerid));
dUserSetINT(PlayerName(playerid)).("Adminlevel",Ad minLevel[playerid]);
dUserSetINT(PlayerName(playerid)).("VIPlevel",VIPL evel[playerid]);
dUserSetINT(PlayerName(playerid)).("Army",CanUseAr my[playerid]);
dUserSetINT(PlayerName(playerid)).("CIA",CanUseCIA[playerid]);
dUserSetINT(PlayerName(playerid)).("GangZ",CanUseG angZ[playerid]);
dUserSetINT(PlayerName(playerid)).("RegularPlayer" ,IsRegularPlayer[playerid]);
dUserSetINT(PlayerName(playerid)).("DrugHouseOwner ",DrugHouseOwner[playerid]);
dUserSetINT(PlayerName(playerid)).("OttoOwner",Ott oOwner[playerid]);
dUserSetINT(PlayerName(playerid)).("TSkill",Terror istSkill[playerid]);
dUserSetINT(PlayerName(playerid)).("RobSkill",RobS kill[playerid]);
dUserSetINT(PlayerName(playerid)).("HasPackC4",Has PackC4[playerid]);
dUserSetINT(PlayerName(playerid)).("HasPackRope",H asPackRope[playerid]);
dUserSetINT(PlayerName(playerid)).("HasPackMoney", HasPackMoney[playerid]);
dUserSetINT(PlayerName(playerid)).("SavedWantedLev el",SavedWantedLevel[playerid]);
dUserSetINT(PlayerName(playerid)).("SavedJailTime" ,SavedJailTime[playerid]);
format(lconnect,sizeof(lconnect)," %d/%d/%d", day,month,year);
dUserSet(PlayerName(playerid)).("LastConnect",lcon nect[playerid]);
}

//Do things to the playerid
ResetVariables(playerid);
TextDrawHideForPlayer(playerid,VersionTD);
TextDrawHideForPlayer(playerid,WebsiteTD);
TextDrawHideForPlayer(playerid,InfoTD);
TextDrawDestroy(MessageTD[playerid]);
TextDrawDestroy(JailTimer[playerid]);
TextDrawDestroy(LocationTD[playerid]);
InAdminMode[playerid] =0;
InVIPMode[playerid] =0;

if (PlayerInfo[playerid][pRoadblock] != 0)
{
RemoveRoadblock(playerid);
}
for(new i = 0; i < sizeof(Objects); i++) ////Xobj
{
if(Player[playerid][view][i])
{
Player[playerid][view][i] = false;
DestroyPlayerObject(playerid,Player[playerid][objid][i]);
}
}
format(string,sizeof(string),"%s(%d) has left the server!",pname,playerid);
SendClientMessageToAll(COLOR_VIOLETBLUE,string);
format(string,sizeof(string),"1%s(%d) has left the server!",pname,playerid);
IRC_Say(gGroupID,IRC_CHANNEL,string);
return 1;
}

Thats all
Reply
#9

It seems you are writing the admin level to file. Can you show me what's present on OnPlayerConnect then if possible?
Reply
#10

public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) return 1;

new string[128];
new pname[24];
new pIp[16];

//Variables
zoneupdates[playerid] =1;

//Connect Messages
format(string,sizeof(string),"{4169FF}[SERVER]: {FFFFFF}Welcome to %s v%s!",svname,sversion);
SendClientMessage(playerid,COLOR_ROYALBLUE,string) ;
SendClientMessage(playerid,COLOR_ROYALBLUE,"{4169F F}[SERVER]: {FFFFFF}If you want to make our job easier, Read /rules and /pc");
SendClientMessage(playerid,COLOR_ROYALBLUE,"{4169F F}[SERVER]: {FFFFFF}This is not a DM Server and you will be punished for killing/shooting at innocent players without a valid reason");
format(string,sizeof(string),"{4169FF}[SERVER]: {FFFFFF}For more info, contact an Administrator online or visit our forums at: %s",sweb);
SendClientMessage(playerid,COLOR_WHITE,string);

//Player Join message
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"%s(%d) has connected to the server!",pname,playerid);
SendClientMessageToAll(COLOR_VIOLETBLUE,string);
format(string,sizeof(string),"6%s(%d) has connected to the server!",pname,playerid);
IRC_Say(gGroupID,IRC_CHANNEL,string);
GetPlayerIp(playerid, pIp, sizeof(pIp));
format(string,sizeof(string),"6%s(%d) has connected to the server! ( IP : %s )",pname,playerid,pIp);
IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string );
format(string,sizeof(string),"%s(%d) has connected to the server! ( IP : %s )",pname,playerid,pIp);
SendClientMessageToAllAdmins(string);
SetPlayerColor(playerid,COLOR_DEADCONNECT);

//Do things to the player
JailTimer[playerid] = TextDrawCreate(505.000000, 411.000000, "Jailtime: 180");
TextDrawBackgroundColor(JailTimer[playerid], -1);
TextDrawFont(JailTimer[playerid], 3);
TextDrawLetterSize(JailTimer[playerid], 0.529999, 1.299999);
TextDrawColor(JailTimer[playerid], 65535);
TextDrawSetOutline(JailTimer[playerid], 1);
TextDrawSetProportional(JailTimer[playerid], 1);
TextDrawUseBox(JailTimer[playerid], 1);
TextDrawBoxColor(JailTimer[playerid], 255);
TextDrawTextSize(JailTimer[playerid], 633.000000, 0.000000);

MessageTD[playerid] = TextDrawCreate(241.000000, 410.000000, "TICKET RECIEVED");
TextDrawBackgroundColor(MessageTD[playerid], 255);
TextDrawFont(MessageTD[playerid], 1);
TextDrawLetterSize(MessageTD[playerid], 0.549999, 1.500000);
TextDrawColor(MessageTD[playerid], -1);
TextDrawSetOutline(MessageTD[playerid], 0);
TextDrawSetProportional(MessageTD[playerid], 1);
TextDrawSetShadow(MessageTD[playerid], 1);
TextDrawUseBox(MessageTD[playerid], 1);
TextDrawBoxColor(MessageTD[playerid], 255);
TextDrawTextSize(MessageTD[playerid], 384.000000, 0.000000);

LocationTD[playerid] = TextDrawCreate(43.000000, 327.000000, "Downtown");
TextDrawBackgroundColor(LocationTD[playerid], 255);
TextDrawFont(LocationTD[playerid], 1);
TextDrawLetterSize(LocationTD[playerid], 0.500000, 1.000000);
TextDrawColor(LocationTD[playerid], -1);
TextDrawSetOutline(LocationTD[playerid], 0);
TextDrawSetProportional(LocationTD[playerid], 1);
TextDrawSetShadow(LocationTD[playerid], 1);

IAM[playerid] = Text3D: INVALID_3DTEXT_ID;
IVM[playerid] = Text3D: INVALID_3DTEXT_ID;

format(string,sizeof(string),"Version: %s",sversion);
TextDrawSetString(VersionTD,string);
TextDrawShowForPlayer(playerid,VersionTD);
TextDrawShowForPlayer(playerid,WebsiteTD);
TextDrawShowForPlayer(playerid,InfoTD);
TogglePlayerClock(playerid,1);

SetPlayerMapIcon(playerid,1,-2626.1843,211.5102,4.6097,6,0); //Ammunation
SetPlayerMapIcon(playerid,2,-2099.6882,899.1699,76.7109,24,0); //CaltonHeightsDH
SetPlayerMapIcon(playerid,3,-2779.9194,0.3026,10.0625,24,0); //OceanFlatsDH
SetPlayerMapIcon(playerid,4,-2576.4824,818.9226,49.9844,24,0); //ParadisoDH
SetPlayerMapIcon(playerid,5,-2433.7866,1281.6011,23.7422,24,0); //JuniperHollowDH
SetPlayerMapIcon(playerid,6,-1547.4066,123.6555,3.5547,9,0); //ShipYard
SetPlayerMapIcon(playerid,7,-1657.7573,1210.2754,7.2500,55,0); //Otto'sCars
SetPlayerMapIcon(playerid,8,-1923.3926,303.6380,41.0469,8,0); //BombShop
SetPlayerMapIcon(playerid,9,-2331.8582,-164.2207,35.5547,10,0); //BurgerShotGarcia
SetPlayerMapIcon(playerid,10,-2671.5444,260.9214,4.6328,10,0); //BurgerShotOcean
SetPlayerMapIcon(playerid,11,370.7744,-6.5378,1001.8589,14,0); //CluckinBellOcean
SetPlayerMapIcon(playerid,12,-2553.8923,193.2280,6.1560,49,0); //GayDarStation
SetPlayerMapIcon(playerid,13,-2241.8118,131.9901,35.3203,47,0); //Zero's
SetPlayerMapIcon(playerid,14,-2242.2817,-85.7698,35.3203,49,0); //Misty's
SetPlayerMapIcon(playerid,15,-1951.9911,300.2070,35.4688,55,0); //WangCars
SetPlayerMapIcon(playerid,16,-2658.3201,639.5060,14.4531,22,0); //Hospital
SetPlayerMapIcon(playerid,17,-2568.8982,243.9241,10.2489,7,0); //Barbers
SetPlayerMapIcon(playerid,18,-2270.1182,-152.8132,35.3203,54,0); //GYM
SetPlayerMapIcon(playerid,19,-2029.2903,-102.0118,35.1641,36,0); //DrivingSchool
SetPlayerMapIcon(playerid,20,-1979.9883,138.0498,27.6875,42,0); //TrainStation
SetPlayerMapIcon(playerid,21,-1911.2001,829.2663,35.1719,10,0); //BurgerShotDowntown
SetPlayerMapIcon(playerid,22,-1886.2000,862.4730,35.1719,45,0); //DowntownZip
SetPlayerMapIcon(playerid,23,-1806.8252,947.8553,24.8906,29,0); //FinancialPizza
SetPlayerMapIcon(playerid,24,-1748.4784,963.3699,24.8828,30,0); //FBI
SetPlayerMapIcon(playerid,25,-1692.5487,949.6002,24.8906,45,0); //DowntownVictim
SetPlayerMapIcon(playerid,26,-1496.8027,919.8218,7.1875,52,0); //Bank
SetPlayerMapIcon(playerid,27,-1609.2813,712.9857,13.7334,30,0); //SFPD
SetPlayerMapIcon(playerid,28,-1719.8079,1356.6371,7.1875,29,0); //EsplanadePizza
SetPlayerMapIcon(playerid,29,-2622.5164,1412.6412,7.0938,49,0); //Jizzy's
SetPlayerMapIcon(playerid,30,-2356.0327,1004.7512,50.8984,10,0); //BurgerShotJuniperHollow
SetPlayerMapIcon(playerid,31,-2374.1877,908.1357,45.4371,45,0); //JuniperHillBinco
SetPlayerMapIcon(playerid,32,-2446.3350,752.2393,35.1719,62,0); //SupaSave
SetPlayerMapIcon(playerid,33,-1814.2487,617.8710,35.1719,14,0); //DowntownCluckin

//Anti-Speed hack detection
SetTimerEx("CheckSpeed", 100, true, "i", playerid);

//Check to see if they are registered or logged in
if(udb_Exists(PlayerName(playerid)))
{
SendClientMessage(playerid,COLOR_ERROR,"This player name has already been registered. Please login before you spawn.");
ShowLoginScreen(playerid);
}
else
if(!udb_Exists(PlayerName(playerid)))
{
SendClientMessage(playerid,COLOR_ERROR,"This player name has not been registered. You must register before playing.");
ShowRegisterScreen(playerid);
}

for(new i = 0; i < sizeof(Objects); i++) Player[playerid][view][i] = false; /////////xobj

return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)