Ladmin

Započeo Maltheus!, Januar 23, 2010, 12:38:47 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Imam isti problem kao ovaj tu lik...
http://forum.sa-mp.com/index.php?topic=133514.0
I ovaj vortex je njemu nešto objasnio ali ja nekužim...
Å ta bih morao napraviti da mi ladmin loada stats/score..

Citat: Maltheus! poslato Januar 23, 2010, 12:38:47 POSLE PODNE
Imam isti problem kao ovaj tu lik...
http://forum.sa-mp.com/index.php?topic=133514.0
I ovaj vortex je njemu nešto objasnio ali ja nekužim...
Å ta bih morao napraviti da mi ladmin loada stats/score..

pa ovako:

Ladmin nema funkciju za ucitavanje prethodnog scora ubijanja,uvek mozes TI da dodas,kad se logujes dobijaju scor iz fajla,a sada ga podesi pomocu SetPlayerScore.

nastoe

public OnPlayerDeath(playerid, killerid, reason)
{
     SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
to dodaj na public onplayerdeath i kada te neko ubi ovaj koji te ubio dobit ce jedan score vise
Poslednja Izmena: Januar 26, 2010, 11:45:07 PRE PODNE od ExtremePower

Ja sam editovao moj ladmin i odradio da loada score, postavicu ti kodove da vidis gde sta treba da ubacis

new PlayerInfo[MAX_PLAYERS][PlayerData]; //1. potrazi Playerinfo i tu ubaci "GiveScore"

enum ServerData
{
MaxPing,
ReadPMs,
ReadCmds,
MaxAdminLevel,
AdminOnlySkins,
AdminSkin,
AdminSkin2,
AdminSkin3,
AdminSkin4,
NameKick,
PartNameKick,
AntiBot,
AntiSpam,
AntiSwear,
NoCaps,
Locked,
Password[128],
GiveWeap,
GiveMoney,
GiveScore,          //Ovde
ConnectMessages,
AdminCmdMsg,
AutoLogin,
MaxMuteWarnings,
DisableChat,
MustLogin,
MustRegister,
};
//============================================================================

dcmd_lconfig(playerid,params[]) {   //Ovde ubaci SaveScore ,tako da mozes u konfiguraciji ukljuciti  i iscljuciti da loada score, 1=on, 0=off
#pragma unused params
if(PlayerInfo[playerid][Level] >= 9)
{
   new string[128];
SendClientMessage(playerid,blue,"    ---=== Admin Configuration ===---");
format(string, sizeof(string), "Max Ping: %dms | ReadPms %d | ReadCmds %d | Max Admin Level %d | AdminOnlySkins %d", ServerInfo[MaxPing],  ServerInfo[ReadPMs],  ServerInfo[ReadCmds],  ServerInfo[MaxAdminLevel],  ServerInfo[AdminOnlySkins] );
SendClientMessage(playerid,blue,string);
format(string, sizeof(string), "AdminSkin1 %d | AdminSkin2 %d | NameKick %d | AntiBot %d | AntiSpam %d | AntiSwear %d", ServerInfo[AdminSkin], ServerInfo[AdminSkin2], ServerInfo[NameKick], ServerInfo[AntiBot], ServerInfo[AntiSpam], ServerInfo[AntiSwear] );
SendClientMessage(playerid,blue,string);
format(string, sizeof(string), "NoCaps %d | Locked %d | Pass %s | SaveWeaps %d | SaveMoney %d | SaveScore %d |//ovde   ConnectMessages %d | AdminCmdMsgs %d", ServerInfo[NoCaps], ServerInfo[Locked], ServerInfo[Password], ServerInfo[GiveWeap], ServerInfo[GiveMoney], ServerInfo[GiveScore], ServerInfo[ConnectMessages], ServerInfo[AdminCmdMsg] );
SendClientMessage(playerid,blue,string);
format(string, sizeof(string), "AutoLogin %d | MaxMuteWarnings %d | ChatDisabled %d | MustLogin %d | MustRegister %d", ServerInfo[AutoLogin], ServerInfo[MaxMuteWarnings], ServerInfo[DisableChat], ServerInfo[MustLogin], ServerInfo[MustRegister] );
SendClientMessage(playerid,blue,string);
}
return 1;
}
//========================================================================================================
dcmd_register(playerid,params[]) //3. Ovde dodaj Score
{
   if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already registered and logged in.");
   if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: This account already exists, please use '/login [password]'.");
   if (strlen(params) == 0) return SendClientMessage(playerid,red,"ACCOUNT: Correct usage: '/register [password]'");
   if (strlen(params) < 4 || strlen(params) > 20) return SendClientMessage(playerid,red,"ACCOUNT: Password length must be greater than three characters");
   if (udb_Create(PlayerName2(playerid),params))
{
    new file[256],name[MAX_PLAYER_NAME], tmp3[100];
    new strdate[20], year,month,day; getdate(year, month, day);
GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(name));
    GetPlayerIp(playerid,tmp3,100); dini_Set(file,"ip",tmp3);
//     dini_Set(file,"password",params);
dUserSetINT(PlayerName2(playerid)).("registered",1);
  format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
dini_Set(file,"RegisteredDate",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
dUserSetINT(PlayerName2(playerid)).("banned",0);
dUserSetINT(PlayerName2(playerid)).("level",0);
            dUserSetINT(PlayerName2(playerid)).("LastOn",0);
    dUserSetINT(PlayerName2(playerid)).("money",0);
    dUserSetINT(PlayerName2(playerid)).("score",0);   //Ovde
    dUserSetINT(PlayerName2(playerid)).("kills",0);
dUserSetINT(PlayerName2(playerid)).("deaths",0);
dUserSetINT(PlayerName2(playerid)).("hours",0);
dUserSetINT(PlayerName2(playerid)).("minutes",0);
dUserSetINT(PlayerName2(playerid)).("seconds",0);
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][Registered] = 1;
SendClientMessage(playerid, yellow, "ACCOUNT: You are now registered, and have been automaticaly logged in");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
return 1;
}
   return 1;
}
//=======================================================================================
LoginPlayer(playerid)  //4. Ovde "GiveScore", "SetPlayerScore"
{
if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
if(ServerInfo[GiveScore] == 1) {SetPlayerScore(playerid, dUserINT(PlayerName2(playerid)).("Score") ); }  //Ovde
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
  PlayerInfo[playerid][hours] = dUserINT(PlayerName2(playerid)).("hours");
  PlayerInfo[playerid][mins] = dUserINT(PlayerName2(playerid)).("minutes");
  PlayerInfo[playerid][secs] = dUserINT(PlayerName2(playerid)).("seconds");
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
}
//==========================================================================================================
SavePlayer(playerid) //5. Ovde ubaci da bi se sacuvalo Score
{
  dUserSetINT(PlayerName2(playerid)).("money",GetPlayerMoney(playerid));
  dUserSetINT(PlayerName2(playerid)).("score",GetPlayerScore(playerid));  //Ovde
  dUserSetINT(PlayerName2(playerid)).("kills",PlayerInfo[playerid][Kills]);
  dUserSetINT(PlayerName2(playerid)).("deaths",PlayerInfo[playerid][Deaths]);

new h, m, s;
   TotalGameTime(playerid, h, m, s);

dUserSetINT(PlayerName2(playerid)).("hours", h);
dUserSetINT(PlayerName2(playerid)).("minutes", m);
dUserSetINT(PlayerName2(playerid)).("seconds", s);

  new Float:x,Float:y,Float:z, interior;
  GetPlayerPos(playerid,x,y,z); interior = GetPlayerInterior(playerid);
   dUserSetINT(PlayerName2(playerid)).("x1",floatround(x));
dUserSetINT(PlayerName2(playerid)).("y1",floatround(y));
dUserSetINT(PlayerName2(playerid)).("z1",floatround(z));
   dUserSetINT(PlayerName2(playerid)).("interior1",interior);

new weap1, ammo1, weap2, ammo2, weap3, ammo3, weap4, ammo4, weap5, ammo5, weap6, ammo6;
GetPlayerWeaponData(playerid,2,weap1,ammo1);// hand gun
GetPlayerWeaponData(playerid,3,weap2,ammo2);//shotgun
GetPlayerWeaponData(playerid,4,weap3,ammo3);// SMG
GetPlayerWeaponData(playerid,5,weap4,ammo4);// AK47 / M4
GetPlayerWeaponData(playerid,6,weap5,ammo5);// rifle
GetPlayerWeaponData(playerid,7,weap6,ammo6);// rocket launcher
  dUserSetINT(PlayerName2(playerid)).("weap1",weap1); dUserSetINT(PlayerName2(playerid)).("weap1ammo",ammo1);
  dUserSetINT(PlayerName2(playerid)).("weap2",weap2); dUserSetINT(PlayerName2(playerid)).("weap2ammo",ammo2);
  dUserSetINT(PlayerName2(playerid)).("weap3",weap3); dUserSetINT(PlayerName2(playerid)).("weap3ammo",ammo3);
dUserSetINT(PlayerName2(playerid)).("weap4",weap4); dUserSetINT(PlayerName2(playerid)).("weap4ammo",ammo4);
  dUserSetINT(PlayerName2(playerid)).("weap5",weap5); dUserSetINT(PlayerName2(playerid)).("weap5ammo",ammo5);
dUserSetINT(PlayerName2(playerid)).("weap6",weap6); dUserSetINT(PlayerName2(playerid)).("weap6ammo",ammo6);

new Float:health; GetPlayerHealth(playerid, Float:health);
new Float:armour; GetPlayerArmour(playerid, Float:armour);
new year,month,day; getdate(year, month, day);
new strdate[20]; format(strdate, sizeof(strdate), "%d.%d.%d",day,month,year);
new file[256]; format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );

dUserSetINT(PlayerName2(playerid)).("health",floatround(health));
   dUserSetINT(PlayerName2(playerid)).("armour",floatround(armour));
dini_Set(file,"LastOn",strdate);
dUserSetINT(PlayerName2(playerid)).("loggedin",0);
dUserSetINT(PlayerName2(playerid)).("TimesOnServer",(dUserINT(PlayerName2(playerid)).("TimesOnServer"))+1);
}
//==========================================================================================================
#if defined DISPLAY_CONFIG //6.
stock ConfigInConsole()
{
print(" ________ Configuration ___________\n");
print(" __________ Chat & Messages ______");
if(ServerInfo[AntiSwear] == 0) print("  Anti Swear:              Disabled "); else print("  Anti Swear:             Enabled ");
if(ServerInfo[AntiSpam] == 0)  print("  Anti Spam:               Disabled "); else print("  Anti Spam:              Enabled ");
if(ServerInfo[ReadCmds] == 0)  print("  Read Cmds:               Disabled "); else print("  Read Cmds:              Enabled ");
if(ServerInfo[ReadPMs] == 0)   print("  Read PMs:                Disabled "); else print("  Read PMs:               Enabled ");
if(ServerInfo[ConnectMessages] == 0) print("  Connect Messages:        Disabled "); else print("  Connect Messages:       Enabled ");
  if(ServerInfo[AdminCmdMsg] == 0) print("  Admin Cmd Messages:     Disabled ");  else print("  Admin Cmd Messages:     Enabled ");
if(ServerInfo[ReadPMs] == 0)   print("  Anti capital letters:    Disabled \n"); else print("  Anti capital letters:   Enabled \n");
print(" __________ Skins ________________");
if(ServerInfo[AdminOnlySkins] == 0) print("  AdminOnlySkins:         Disabled "); else print("  AdminOnlySkins:         Enabled ");
printf("  Admin Skin 1 is:         %d", ServerInfo[AdminSkin] );
printf("  Admin Skin 2 is:         %d\n", ServerInfo[AdminSkin2] );
print(" ________ Server Protection ______");
if(ServerInfo[AntiBot] == 0) print("  Anti Bot:                Disabled "); else print("  Anti Bot:                Enabled ");
if(ServerInfo[NameKick] == 0) print("  Bad Name Kick:           Disabled\n"); else print("  Bad Name Kick:           Enabled\n");
print(" __________ Ping Control _________");
if(ServerInfo[MaxPing] == 0) print("  Ping Control:            Disabled"); else print("  Ping Control:            Enabled");
printf("  Max Ping:                %d\n", ServerInfo[MaxPing] );
print(" __________ Players ______________");
if(ServerInfo[GiveWeap] == 0) print("  Save/Give Weaps:         Disabled"); else print("  Save/Give Weaps:         Enabled");
if(ServerInfo[GiveMoney] == 0) print("  Save/Give Money:         Disabled\n"); else print("  Save/Give Money:         Enabled\n");
if(ServerInfo[GiveScore] == 0) print("  Save/Give Score:         Disabled\n"); else print("  Save/Give Score:         Enabled\n"); //Ovde
print(" __________ Other ________________");
printf("  Max Admin Level:         %d", ServerInfo[MaxAdminLevel] );
if(ServerInfo[Locked] == 0) print("  Server Locked:           No"); else print("  Server Locked:           Yes");
if(ServerInfo[AutoLogin] == 0) print("  Auto Login:             Disabled\n"); else print("  Auto Login:              Enabled\n");
}
#endif

//=====================[ Configuration ] =======================================
stock UpdateConfig()  
{
new file[256], File:file2, string[100]; format(file,sizeof(file),"ladmin/config/Config.ini");
ForbiddenWordCount = 0;
BadNameCount = 0;
BadPartNameCount = 0;

if(!dini_Exists("ladmin/config/aka.txt")) dini_Create("ladmin/config/aka.txt");

if(!dini_Exists(file))
{
dini_Create(file);
print("\n >Configuration File Successfully Created");
}

if(!dini_Isset(file,"MaxPing")) dini_IntSet(file,"MaxPing",1200);
if(!dini_Isset(file,"ReadPms")) dini_IntSet(file,"ReadPMs",1);
if(!dini_Isset(file,"ReadCmds")) dini_IntSet(file,"ReadCmds",1);
if(!dini_Isset(file,"MaxAdminLevel")) dini_IntSet(file,"MaxAdminLevel",9);
if(!dini_Isset(file,"AdminOnlySkins")) dini_IntSet(file,"AdminOnlySkins",0);
if(!dini_Isset(file,"AdminSkin")) dini_IntSet(file,"AdminSkin",217);
if(!dini_Isset(file,"AdminSkin2")) dini_IntSet(file,"AdminSkin2",214);
if(!dini_Isset(file,"AdminSkin3")) dini_IntSet(file,"AdminSkin3",115);
if(!dini_Isset(file,"AdminSkin4")) dini_IntSet(file,"AdminSkin4",116);
if(!dini_Isset(file,"AntiBot")) dini_IntSet(file,"AntiBot",1);
if(!dini_Isset(file,"AntiSpam")) dini_IntSet(file,"AntiSpam",1);
if(!dini_Isset(file,"AntiSwear")) dini_IntSet(file,"AntiSwear",1);
if(!dini_Isset(file,"NameKick")) dini_IntSet(file,"NameKick",1);
if(!dini_Isset(file,"PartNameKick")) dini_IntSet(file,"PartNameKick",1);
if(!dini_Isset(file,"NoCaps")) dini_IntSet(file,"NoCaps",0);
if(!dini_Isset(file,"Locked")) dini_IntSet(file,"Locked",0);
if(!dini_Isset(file,"SaveWeap")) dini_IntSet(file,"SaveWeap",0);
if(!dini_Isset(file,"SaveMoney")) dini_IntSet(file,"SaveMoney",1);
if(!dini_Isset(file,"SaveScore")) dini_IntSet(file,"SaveScore",1);                                   //Ovde
if(!dini_Isset(file,"ConnectMessages")) dini_IntSet(file,"ConnectMessages",1);
if(!dini_Isset(file,"AdminCmdMessages")) dini_IntSet(file,"AdminCmdMessages",1);
if(!dini_Isset(file,"AutoLogin")) dini_IntSet(file,"AutoLogin",1);
if(!dini_Isset(file,"MaxMuteWarnings")) dini_IntSet(file,"MaxMuteWarnings",4);
if(!dini_Isset(file,"MustLogin")) dini_IntSet(file,"MustLogin",0);
if(!dini_Isset(file,"MustRegister")) dini_IntSet(file,"MustRegister",0);

if(dini_Exists(file))
{
ServerInfo[MaxPing] = dini_Int(file,"MaxPing");
ServerInfo[ReadPMs] = dini_Int(file,"ReadPMs");
ServerInfo[ReadCmds] = dini_Int(file,"ReadCmds");
ServerInfo[MaxAdminLevel] = dini_Int(file,"MaxAdminLevel");
ServerInfo[AdminOnlySkins] = dini_Int(file,"AdminOnlySkins");
ServerInfo[AdminSkin] = dini_Int(file,"AdminSkin");
ServerInfo[AdminSkin2] = dini_Int(file,"AdminSkin2");
ServerInfo[AdminSkin3] = dini_Int(file,"AdminSkin3");
ServerInfo[AdminSkin4] = dini_Int(file,"AdminSkin4");
ServerInfo[AntiBot] = dini_Int(file,"AntiBot");
ServerInfo[AntiSpam] = dini_Int(file,"AntiSpam");
ServerInfo[AntiSwear] = dini_Int(file,"AntiSwear");
ServerInfo[NameKick] = dini_Int(file,"NameKick");
ServerInfo[PartNameKick] = dini_Int(file,"PartNameKick");
ServerInfo[NoCaps] = dini_Int(file,"NoCaps");
ServerInfo[Locked] = dini_Int(file,"Locked");
ServerInfo[GiveWeap] = dini_Int(file,"SaveWeap");
ServerInfo[GiveMoney] = dini_Int(file,"SaveMoney");
ServerInfo[GiveScore] = dini_Int(file,"SaveScore");                        //Ovde
ServerInfo[ConnectMessages] = dini_Int(file,"ConnectMessages");
ServerInfo[AdminCmdMsg] = dini_Int(file,"AdminCmdMessages");
ServerInfo[AutoLogin] = dini_Int(file,"AutoLogin");
ServerInfo[MaxMuteWarnings] = dini_Int(file,"MaxMuteWarnings");
ServerInfo[MustLogin] = dini_Int(file,"MustLogin");
ServerInfo[MustRegister] = dini_Int(file,"MustRegister");
print("\n -Configuration Settings Loaded");
}



Nadam se da ce ti pomoci.
Poslednja Izmena: Januar 26, 2010, 16:35:06 POSLE PODNE od Padrino

Možeš li mi padrino dati svoj ladmin jer ovdje mi je sve zamršeno? :-*

nastoe

aha to je u FS e sorry onda ovaj moj kod zaboravi ;)

Evo odradio sam ti drugi,znaci isti je samo sto moze da loada i sejva score, kad ga postavis udji u igru "/setscore tvoj id i koliko, onda izadji i udji ponovo" tako ces videti da li radi, ali pre svega toga obavezno udji u folder "scriptfiles > ladmin  > config" i postavo savescore na 1 (SaveScore=1)

http://solidfiles.com/d/uVyp

JA neznam samo sta ce vam ovo.Ako vec planirate da otvarate neke servere lepo uzmite i napravite nesto sami!!!

Extreme Power
Hvala svejedno  ;)
Citat: Padrino poslato Januar 26, 2010, 21:49:54 POSLE PODNE
Evo odradio sam ti drugi,znaci isti je samo sto moze da loada i sejva score, kad ga postavis udji u igru "/setscore tvoj id i koliko, onda izadji i udji ponovo" tako ces videti da li radi, ali pre svega toga obavezno udji u folder "scriptfiles > ladmin  > config" i postavo savescore na 1 (SaveScore=1)

http://solidfiles.com/d/uVyp
Hvala  i tebi  :-* Pomoglo je
Poslednja Izmena: Januar 28, 2010, 04:40:57 PRE PODNE od Maltheus!

nastoe

Citat: _JoKeR_ poslato Januar 26, 2010, 22:05:56 POSLE PODNE
JA neznam samo sta ce vam ovo.Ako vec planirate da otvarate neke servere lepo uzmite i napravite nesto sami!!!
najbolje vam je sami, ili vec ako uzimate admin skripte preuredite ih cijele!!! Ne micati credits nego nepotrebne komande dodavati svoje stvari itd. server ce vam uspijeti uvijek ako je pisan od >0<