22.04.2012, 12:06
Hey I made my own login and register for my server more than a year ago. It worked fine. When admin logged in it said: PLayerName has logged in as Level 5 Administrator. or when you login it says: ''you are now logged it'' . but now, maybe outdated script, it doesn't work anymore. can someone help me?
pawn Код:
dcmd_login(playerid,params[])
{
if(LoggedIn[playerid] == 1) return SystemMsg(playerid,"You are already logged in!");
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if(!udb_Exists(playername)) return SystemMsg(playerid,"Account doesn't exist, please use /register [password].");
if(strlen(params)==0) return SystemMsg(playerid,"USAGE: /login [password]");
if(udb_CheckLogin(playername,params)) // Login was correct
{
LoggedIn[playerid] = 1;
GivePlayerMoney(playerid,dUserINT(playername).("Money"));
pInfo[playerid][pAdmin] = dUserINT(playername).("Admin");
pInfo[playerid][pDeaths] = dUserINT(playername).("Deaths");
pInfo[playerid][pKills] = dUserINT(playername).("Kills");
pInfo[playerid][pDonator] = dUserINT(playername).("Donator");
pInfo[playerid][pUFMember] = dUserINT(playername).("Urban Fighters");
SetPlayerScore(playerid,pInfo[playerid][pKills] + GetPlayerScore(playerid));
new donatorTxt[128], output1[128], output2[128];
switch(pInfo[playerid][pDonator])
{
case 0: format(donatorTxt, sizeof(donatorTxt), "No");
case 1: format(donatorTxt, sizeof(donatorTxt), "Bronze");
case 2: format(donatorTxt, sizeof(donatorTxt), "Silver");
case 3: format(donatorTxt, sizeof(donatorTxt), "Gold");
}
if(pInfo[playerid][pAdmin] > 1 && pInfo[playerid][pDonator] > 1)
{
format(output1, sizeof(output1), "SERVER: You are now logged in [Admin level %i] [Donator level %s].", pInfo[playerid][pAdmin], donatorTxt);
format(output2, sizeof(output2), "%s has logged in as level %i Administrator.", playername, pInfo[playerid][pAdmin]);
SystemMsg(playerid, output1);
for(new x=0; x <= MAX_PLAYERS; x ++)
{
if(x != playerid)
{
SendClientMessage(x, COLOR_GOLD, output2);
}
}
}
if(pInfo[playerid][pAdmin] > 1 && !(pInfo[playerid][pDonator] > 0))
{
format(output1, sizeof(output1), "SERVER: You are now logged in [Admin level %i].", pInfo[playerid][pAdmin]);
format(output2, sizeof(output2), "%s has logged in as level %i Administrator.", playername, pInfo[playerid][pAdmin]);
SystemMsg(playerid, output1);
for(new x=0; x <= MAX_PLAYERS; x ++)
{
if(x != playerid)
{
SendClientMessage(x, COLOR_GOLD, output2);
}
}
}
if(!(pInfo[playerid][pAdmin] > 0) && pInfo[playerid][pDonator] > 1)
{
format(output1, sizeof(output1), "SERVER: You are not logged in [Donator level %s].", donatorTxt);
SystemMsg(playerid, output1);
}
return 1;
}
return SendClientMessage(playerid, COLOR_RED, "SERVER: Wrong password!");
}