04.06.2011, 13:53
Well, after posting endless amounts of requests, my server is nearing its completion.
Going through lots of admin systems I decided to stay with a nice basic one named XtremeAdmin.
I would like to edit XtremeAdmin to disable its Auto Log in feature and instead of a /login command, I would like to use DIALOG_STYLE_INPUT.
Here is the OnPlayerConnect
And here is the command to log in.
So I want that command to be gone and a Input Dialog to come up when you connect, and if you press Esc or Cancel it will kick you.
Next script: GPS System
Probably the best script I ever made, but there is some bugs. If I were to press Esc or Cancel, it works like the Select button, Eh? It was my first time using a dialog to. :S.
Last Script.
I never used something to make a file before, XtremeAdmin for some reason wont save scores/money, Eh? So I decided to make my own script. Now, when a player connects, it makes a new file in the following route, /server/scriptfiles/scoremoney<Playername>, and in that players file, there are two things.
Score=
Money=
And thats it, so when they connect, they can keep there scores and money.
This is hopefully the last post I will need for my server.
But heres to the people who made it in the credits:
Hayden_Bruin - Helping me with small codes
Sascha - For helping me with a Early Wanring System.
blewert - Helping with the Early Warning System and the Score Requirement system
Swat123 - Helping with my aircraft pannel
And to all the other people I missed out.
Going through lots of admin systems I decided to stay with a nice basic one named XtremeAdmin.
I would like to edit XtremeAdmin to disable its Auto Log in feature and instead of a /login command, I would like to use DIALOG_STYLE_INPUT.
Here is the OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid) {
new string[256],PlayerName[24],file[256]; file = GetPlayerFile(playerid);
GetPlayerName(playerid,PlayerName,24); if(!dini_Exists(file)) CreateUserConfigFile(playerid);
for(new i = 0; i < 100; i++) {
if(strfind(PlayerName,ForbidNames[i],true)!=-1 && Config[ForbidData]) {
switch(Config[ForbidData]) { case 1: Kick(playerid); case 2: Ban(playerid); }
return 1;
}
}
if(Config[DisplayServerMessage]) { format(string,sizeof(string),"Server Message: %s",dini_Get("/xadmin/Configuration/Configuration.ini","ServerMessage")); SendClientMessage(playerid,green,string); }
Variables[playerid][Registered] = GetPlayerFileVar(playerid,"Registered"),
Variables[playerid][Level] = GetPlayerFileVar(playerid,"Level");
Variables[playerid][Wired] = GetPlayerFileVar(playerid,"Wired");
Variables[playerid][Jailed] = GetPlayerFileVar(playerid,"Jailed");
if(Variables[playerid][Wired]) SetUserInt(playerid,"WiredWarnings",Config[WiredWarnings]);
if(Variables[playerid][Level] > Config[MaxLevel]) { Variables[playerid][Level] = Config[MaxLevel]; SetUserInt(playerid,"Level",Config[MaxLevel]); }
if(!Variables[playerid][Registered]) format(string,256,"Welcome, %s. To register an account to this server, type \"/REGISTER <PASSWORD>\".",PlayerName);
else {
new tmp[50],tmp2[256]; GetPlayerIp(playerid,tmp,50); tmp2 = dini_Get(file,"IP");
if(!strcmp(tmp,tmp2,true)) {
format(string,256,"Welcome back, %s. You have automatically been logged in.",PlayerName);
Variables[playerid][LoggedIn] = true;
}
else {
format(string,256,"Welcome back, %s. To log back into your account, type \"/LOGIN <PASSWORD>\".",PlayerName);
Variables[playerid][LoggedIn] = false;
}
}
SendClientMessage(playerid,yellow,string);
for(new i = 0; i < MAX_VEHICLES; i++) if(VehicleLockData[i]) SetVehicleParamsForPlayer(i,playerid,false,true);
if(Config[DisplayConnectMessages]) { format(string,256,"*** %s has joined the server.",PlayerName); for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && playerid != i) SendClientMessage(i,grey,string); }
return 1;
}
pawn Код:
dcmd_login(playerid,params[]) {
if(!strlen(params)) { SendClientMessage(playerid,red,"Syntax Error: \"/LOGIN <PASSWORD>\"."); return 1; }
new index = 0;
new Password[256], string[256]; Password = strtok(params,index);
new PlayerFile[256]; PlayerFile = GetPlayerFile(playerid);
if(Variables[playerid][Registered] && !Variables[playerid][LoggedIn]) {
if(udb_hash(Password) == dini_Int(PlayerFile,"Password")) {
switch(Variables[playerid][Level]) {
case 0: format(string,sizeof(string),"You have logged into your account. [Status Level: Member]");
default: format(string,sizeof(string),"You have logged into your account. [Status Level: Administrator Lv. %d]",Variables[playerid][Level]);
}
SendClientMessage(playerid,blue,string);
SetUserInt(playerid,"LoggedIn",1); Variables[playerid][LoggedIn] = true;
new tmp3[100]; GetPlayerIp(playerid,tmp3,100); SetUserString(playerid,"IP",tmp3);
OnPlayerLogin(playerid,true);
} else { OnPlayerLogin(playerid,false); SendClientMessage(playerid,red,"Syntax Error: \"/LOGIN <PASSWORD>\"."); }
} else SendClientMessage(playerid,red,"Error: You must be registered to log in; if you have make sure you haven't already logged in.");
return 1;
}
Next script: GPS System
pawn Код:
#include <a_samp>
#include <a_colors>
#include <JunkBuster>
#define GPSID 7777
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/gps", true))
{
ShowPlayerDialog(playerid, GPSID, DIALOG_STYLE_LIST, "Global Positioning System", "Creek Airport \nIsland De Monta\nVPI (Virutal Pilots Island)\nCancel GPS", "Select", "Cancel");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == GPSID)
{
if(listitem == 0)
{
SendClientMessage(playerid, COLOR_RED, "GPS Set to: Creek Airport.");
SetPlayerCheckpoint(playerid, 2861.4902, 1927.3245, 10.8400, 3.0);
}
if(listitem == 1)
{
SendClientMessage(playerid, COLOR_RED, "GPS Set to: Island De Monta.");
SetPlayerCheckpoint(playerid, 3881.1858, -3272.8784, 6.9297, 3.0);
}
if(listitem == 2)
{
SendClientMessage(playerid, COLOR_RED, "GPS Set to: Virtual Pilots Island.");
SetPlayerCheckpoint(playerid, 0, 0, 0, 3.0);
}
if(listitem == 3)
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_RED, "Global Positioning System deactivated.");
}
return 1;
}
return 0;
}
Last Script.
I never used something to make a file before, XtremeAdmin for some reason wont save scores/money, Eh? So I decided to make my own script. Now, when a player connects, it makes a new file in the following route, /server/scriptfiles/scoremoney<Playername>, and in that players file, there are two things.
Score=
Money=
And thats it, so when they connect, they can keep there scores and money.
This is hopefully the last post I will need for my server.
But heres to the people who made it in the credits:
Hayden_Bruin - Helping me with small codes
Sascha - For helping me with a Early Wanring System.
blewert - Helping with the Early Warning System and the Score Requirement system
Swat123 - Helping with my aircraft pannel
And to all the other people I missed out.