Newbie chat ranks -
NotoriousMOB - 11.04.2011
Hi tryin to fix this Newbie chat
i use this command to make a player a Helper
pawn Код:
if(strcmp(cmd, "/makehelper", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehelper [playerid/PartOfName] [level(1-2)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(IsPlayerConnected(para1))
{
if(PlayerInfo[playerid][pHelper] >= 2 || PlayerInfo[playerid][pAdmin] >= 4242)
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pHelper] = level;
printf("AdmCmd: %s has made %s a level %d helper", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d helper by %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have promoted %s to a level %d helper.", giveplayer,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are authorized to use this command.");
}
}
return 1;
}
What i want is for it to save the rank after relog
when i make a player a helper and he relogs he's rank becomes newbie again.
would be thankfull
Re: Newbie chat ranks -
Dudits - 11.04.2011
Check the lines where it saves player's info, make it save his helper rank.
Same with loading when the player logs in.
Re: Newbie chat ranks -
Rivera - 11.04.2011
it's easy. In the beginning of your script you must add
pawn Код:
enum pInfo {
helper[64],
newbie[64]
}
etc...
And in your cmd you should add some dini! lines. I think they're Dini_IntSet or something
Re: Newbie chat ranks -
NotoriousMOB - 11.04.2011
Rivera can you explain a bit better?
Re: Newbie chat ranks -
Rivera - 11.04.2011
Okay, if you want to save something after the player logs off, you have to use dini. Unfortunately, I have not used dini before so I can't help you, but you should search for a /register /login system, and add those lines in the beginning.
Re: Newbie chat ranks -
NotoriousMOB - 11.04.2011
pawn Код:
dini_IntSet(file,"Logged",1);
PHelper[playerid] = 1;
PAdmin[playerid] = dini_Int(file,"Level");
Only these 3 or what?
But okay i'll wait maybe someone can help out else im on deep water here.
Re: Newbie chat ranks -
Rivera - 11.04.2011
Here, try this:
Top of script:
pawn Код:
enum pInfo {
helper[64],
}
Then:
pawn Код:
public OnPlayerConnect(playerid)
{
new file[128], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), UserFile, Name);
if(!fexist(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register", "Please fill in a password:", "Register", "Cancel");
}
else
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "Please fill in your password:", "Login", "Cancel");
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new file[128], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), UserFile, Name);
dini_IntSet(file, "helper", gPlayerInfo[playerid][Level]);
gPlayerLogged[playerid] = 0;
return 1;
}
Got them from
here.
Hope it works!
Re: Newbie chat ranks -
NotoriousMOB - 11.04.2011
Tried some times now it still crashes the script when compile tho
which parts shall i take i this its very confusing when i don't know a thing bout dini. :P