VERY simple admin script -
StrickenKid - 22.02.2009
*******im NOT looking for any pre made filterscripts
im looking for a VERY simple admin script that someone scripted up or can script up for me with only /ban and /kick cmds.
and if possible a SIMPLE login system with NO autologin. AND only 1 Level of admin!
i wana make my own admin script but dont know how to start, if someone could be kind enough to start a simple 1, i could add on to it.
PLZ AND THX!
Re: VERY simple admin script -
Lazarus - 22.02.2009
pawn Код:
#include <a_samp>
new Level[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
Level[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/alogin password", cmdtext, true, 5) == 0)
{
Level[playerid] = 1;
return 1;
}
if(strcmp("/kick", cmdtext, true, 5) == 0)
{
if(Level[playerid] == 0) return 1;
if(strlen(cmdtext[6]) == 0) return 1;
Kick(strval(cmdtext[6]));
return 1;
}
if(strcmp("/ban", cmdtext, true, 4) == 0)
{
if(Level[playerid] == 0) return 1;
if(strlen(cmdtext[5]) == 0) return 1;
Ban(strval(cmdtext[5]));
return 1;
}
return 0;
}
That's as simple as it gets.
Re: VERY simple admin script -
StrickenKid - 22.02.2009
thats great thx, but thats a little to simple :S sorry i didnt put this first but, i wanted with like the files, so i can make multiple admins, so like when they log in, it checks a file that has there stats saved in it.
Re: VERY simple admin script -
Lazarus - 22.02.2009
Well, then it turns from SIMPLE to PROPER, in a sense

.
pawn Код:
#include <a_samp>
#include <dini>
new Level[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
Level[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/aregister", cmdtext, true, 10) == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(dini_Exists(pname) == 1) return 1;
if(strlen(cmdtext[11]) == 0) return 1;
dini_Create(pname);
dini_Set(pname, "password", cmdtext[11]);
dini_IntSet(pname, "level", 0);
return 1;
}
if(strcmp("/alogin", cmdtext, true, 7) == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(dini_Exists(pname) == 0) return 1;
if(strlen(cmdtext[8]) == 0) return 1;
if(strcmp(dini_Get(pname, "password"), cmdtext[8], true) != 0) return 1;
Level[playerid] = dini_Int(pname, "level");
return 1;
}
if(strcmp("/kick", cmdtext, true, 5) == 0)
{
if(Level[playerid] == 0) return 1;
if(strlen(cmdtext[6]) == 0) return 1;
Kick(strval(cmdtext[6]));
return 1;
}
if(strcmp("/ban", cmdtext, true, 4) == 0)
{
if(Level[playerid] == 0) return 1;
if(strlen(cmdtext[5]) == 0) return 1;
Ban(strval(cmdtext[5]));
return 1;
}
return 0;
}
Make sure you have
dini.
Re: VERY simple admin script -
StrickenKid - 22.02.2009
THX allot man! you saved me allot of headaches!
only 1 thing, where would i put the text in that sais:
logged in successful
account already in use
login failed
usage: /login [password]
usage: /register [password]
etc....
Re: VERY simple admin script -
StrickenKid - 22.02.2009
umm.... i just tred the script, and i get a SERVER UNKNOWN COMMAND thing, and i intalled it fine...
i only get the message if i type in /aregister [password] but if i just type /aregister, nothing happends...
Re: VERY simple admin script -
Lazarus - 22.02.2009
On lines like:
pawn Код:
if(dini_Exists(pname) == 1) return 1;
You could put:
pawn Код:
if(dini_Exists(pname) == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "Account already registered");
Nothing happens because it's set to do nothing. You have to do above ^.
Re: VERY simple admin script -
StrickenKid - 22.02.2009
but why do i get an unknown command?
Re: VERY simple admin script -
Lazarus - 22.02.2009
I just tested it, and I dont.
Did you change the command from "/aregister" to something else?
Re: VERY simple admin script -
x-cutter - 22.02.2009
Check bogeyman_EST's tutorial for an easy register script using DINI