Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/evehost/public_html/games/engine/classes/templates.class.php on line 68 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/evehost/public_html/games/engine/classes/templates.class.php on line 72 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/evehost/public_html/games/engine/classes/templates.class.php on line 72 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/evehost/public_html/games/engine/modules/show.full.php on line 343 Настройка сервера samp » Игры 21 века



.
Опрос

Вы знаете что такое mmorpg?
Да
Нет

Настройка сервера samp

Дата: 13-07-2013, 08:24 Опубликовал: admin Комментариев: 0
Осуществить настройку сервера samp, можно в файлах конфигурации с расширением: .ini или .cfg.
Пример файла .ini(аккаунт):
Key=qwerty
Level=3
AdminLevel=0
Money=25100
Job=25
Email=support[собака]mail.ru

Благодаря этому .ini файлу, мы можем настроить уровень игрока, его количество денег, сменить email, работу или же пароль.

Пример файла .cfg():
15
2313.434570,-1262.048339,24.462320,0.000000,0.000000,90.000000,2311.748535,-1262.048339,25.951297,90.000000,0.000000,90.000000,2317.435791,-1261.521972,23.593599,90.011596,The State,562,20000
2313.434570,-1267.314453,24.557285,0.000000,0.000000,90.000000,2311.748535,-1267.314453,25.951297,90.000000,179.994506,270.000000,2316.917724,-1266.964843,23.597000,90.410697,The State,562,20000
2313.434570,-1272.839843,24.578714,0.000000,0.000000,90.000000,2311.748535,-1272.839843,25.951297,90.000000,179.994506,269.989013,2317.016845,-1272.452514,23.600799,89.941902,The State,562,20000
2313.434570,-1278.156250,24.557285,0.000000,0.000000,90.000000,2311.748535,-1278.156250,25.951297,90.000000,180.005493,269.978027,2317.373046,-1277.987060,23.597000,89.566101,The State,562,20000
2461.218750,-1413.435546,24.365510,0.000000,0.000000,90.000000,2459.685546,-1413.437500,25.863443,90.000000,0.000000,90.000000,2464.841796,-1412.943603,23.403499,88.555702,The State,562,10000
2461.193847,-1424.415283,24.369785,0.000000,0.000000,90.000000,2459.561035,-1424.439819,25.861862,90.000000,0.000000,90.000000,2465.090576,-1424.053222,23.409999,87.947502,The State,562,10000
485.105560,-1326.846557,16.092739,0.000000,0.000000,31.245117,484.431549,-1325.771972,17.592517,90.000000,0.000000,31.239624,487.081298,-1329.118164,15.104397,31.299999,The State,562,30000
481.200836,-1329.203979,16.063190,0.000000,0.000000,31.239624,480.619140,-1328.042968,17.592517,90.000000,0.000000,31.239624,483.072113,-1331.446533,15.099200,30.034000,The State,562,30000
477.277526,-1331.604492,16.065719,0.000000,0.000000,31.239624,476.873046,-1330.305664,17.592517,90.000000,0.000000,31.239624,479.442413,-1333.731933,15.095000,31.846200,The State,562,30000
447.733245,-1349.555175,15.447340,0.000000,0.000000,32.244873,446.972656,-1348.429199,17.000383,90.000000,0.000000,32.244873,449.578887,-1351.895874,14.494000,31.245500,The State,562,20000
443.888946,-1351.959838,15.440754,0.000000,0.000000,31.494873,443.274108,-1350.789794,17.000383,90.000000,0.000000,32.244873,445.838806,-1354.132812,14.482297,30.830400,The State,562,20000
440.041625,-1354.278320,15.435771,0.000000,0.000000,31.494873,439.493072,-1353.085815,17.000383,90.000000,0.000000,32.244873,442.027099,-1356.558959,14.480400,30.810899,The State,562,20000
436.254241,-1356.655029,15.430657,0.000000,0.000000,32.244873,435.806945,-1355.403930,17.000383,90.000000,0.000000,32.244873,437.992095,-1359.048217,14.474100,31.291299,The State,562,20000
432.551605,-1358.924682,15.425085,0.000000,0.000000,31.244873,431.933715,-1357.749267,17.000383,90.000000,0.000000,32.244873,434.198211,-1361.381469,14.462900,30.223199,The State,562,20000
428.705017,-1361.235595,15.419095,0.000000,0.000000,32.494873,428.089141,-1360.107788,17.000383,90.000000,0.000000,32.244873,430.464904,-1363.681030,14.460100,31.163700,The State,562,20000

Благодаря этому .cfg файлу, мы можем настроить координаты связанные с местоположением гаража.

Пример от него файла .pwn:
#include <a_samp>

new CountGarages;
new ChooseGarage[MAX_PLAYERS];
new b;//Защита от DeAMX. На emit`e.
#emit LOAD.pri b//Защита от DeAMX. На emit`e.
#emit STOR.pri b//Защита от DeAMX. На emit`e.

enum GI
{
	Float:StartX,
	Float:StartY,
	Float:StartZ,
	Float:StartRX,
	Float:StartRY,
	Float:StartRZ,
	Float:EndX,
	Float:EndY,
	Float:EndZ,
	Float:EndRX,
	Float:EndRY,
	Float:EndRZ,
	Float:SpawnCarX,
	Float:SpawnCarY,
	Float:SpawnCarZ,
	Float:SpawnCarA,
	GarageDoor,
	Car,
	VehID,
	Cost,
	Owner[MAX_PLAYER_NAME],
 	GaragePickup,
 	CarPickup,
 	StatusGate,
	Text3D:GarageText,
};

new GarageInfo[30][GI];


forward split(const strsrc[], strdest[][], delimiter);
forward LoadGarages();
forward UpdateGarages();

public LoadGarages()
{
	new Pos[19][50];
	new FileStr[256];
	new s[128];
	new File: file = fopen("Garages.cfg", io_read);
	if (file)
	{
		fread(file, FileStr);
		split(FileStr, Pos, ',');
		CountGarages = strval(Pos[0]);
		printf("garages- %d",CountGarages);
		for(new i; i<CountGarages; i++)
		{
			fread(file, FileStr);
			split(FileStr, Pos, ',');
			GarageInfo[i][StartX] = floatstr(Pos[0]);
			GarageInfo[i][StartY] = floatstr(Pos[1]);
			GarageInfo[i][StartZ] = floatstr(Pos[2]);
			GarageInfo[i][StartRX] = floatstr(Pos[3]);
			GarageInfo[i][StartRY] = floatstr(Pos[4]);
			GarageInfo[i][StartRZ] = floatstr(Pos[5]);
			GarageInfo[i][EndX] = floatstr(Pos[6]);
			GarageInfo[i][EndY] = floatstr(Pos[7]);
			GarageInfo[i][EndZ] = floatstr(Pos[8]);
			GarageInfo[i][EndRX] = floatstr(Pos[9]);
			GarageInfo[i][EndRY] = floatstr(Pos[10]);
			GarageInfo[i][EndRZ] = floatstr(Pos[11]);
			GarageInfo[i][SpawnCarX] = floatstr(Pos[12]);
			GarageInfo[i][SpawnCarY] = floatstr(Pos[13]);
			GarageInfo[i][SpawnCarZ] = floatstr(Pos[14]);
			GarageInfo[i][SpawnCarA] = floatstr(Pos[15]);
			strmid(GarageInfo[i][Owner], Pos[16], 0, strlen(Pos[16]), 255);
			GarageInfo[i][VehID] = strval(Pos[17]);
			GarageInfo[i][Cost] = strval(Pos[18]);
			GarageInfo[i][GarageDoor] = CreateObject(2957,GarageInfo[i][StartX],GarageInfo[i][StartY],GarageInfo[i][StartZ],GarageInfo[i][StartRX],GarageInfo[i][StartRY],GarageInfo[i][StartRZ]);
			GarageInfo[i][Car] = CreateVehicle(GarageInfo[i][VehID],GarageInfo[i][SpawnCarX],GarageInfo[i][SpawnCarY],GarageInfo[i][SpawnCarZ],GarageInfo[i][SpawnCarA],-1, -1, 300);
			GarageInfo[i][GaragePickup] = CreatePickup(0, 1, GarageInfo[i][StartX],GarageInfo[i][StartY],GarageInfo[i][StartZ]-0.5, -1);
			GarageInfo[i][CarPickup] = CreatePickup(0, 14, GarageInfo[i][SpawnCarX],GarageInfo[i][SpawnCarY],GarageInfo[i][SpawnCarZ], -1);
			if (!strcmp("The State", GarageInfo[i][Owner])) format(s,256,"{FC5C05}.::{02F23A}Гараж{FC5C05}::.\n{0004FF}Продается!{E8DB1E}цена{FC5C05}:{E8DB1E}$%d{AA22EE}",GarageInfo[i][Cost]);
			else format(s,256,"{FC5C05}.::{02F23A}Гараж{FC5C05}::.\n {0004FF}Владелец{FC5C05}:{E8DB1E} %s \n{0004FF}Открыть{FC5C05}|{0004FF}закрыть{FC5C05}:{E8DB1E}/gate\n{0004FF}Продать{FC5C05}:{E8DB1E}/sellgarage",GarageInfo[i][Owner]);
			GarageInfo[i][GarageText] = Create3DTextLabel(s,1,GarageInfo[i][StartX],GarageInfo[i][StartY],GarageInfo[i][StartZ],50.00,0);
		}
	}
	fclose(file);
	return 1;
}

public UpdateGarages()
{
	new File: file;
	for(new i; i<CountGarages; i++)
	{
		new pos[1000];
		format(pos, sizeof(pos), "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%s,%d,%d\n",
		GarageInfo[i][StartX],GarageInfo[i][StartY],GarageInfo[i][StartZ],GarageInfo[i][StartRX],
		GarageInfo[i][StartRY],GarageInfo[i][StartRZ],GarageInfo[i][EndX],GarageInfo[i][EndY],
		GarageInfo[i][EndZ],GarageInfo[i][EndRX],GarageInfo[i][EndRY],GarageInfo[i][EndRZ],
		GarageInfo[i][SpawnCarX],GarageInfo[i][SpawnCarY],GarageInfo[i][SpawnCarZ],
		GarageInfo[i][SpawnCarA],GarageInfo[i][Owner],GarageInfo[i][VehID],GarageInfo[i][Cost]);
		if(i == 0)
		{
			file = fopen("Garages.cfg", io_write);
			new s[1024];
			format(s,1024,"%d\n%s",CountGarages,pos);
			fwrite(file, s);
			fclose(file);
		}
		else
		{
			file = fopen("Garages.cfg", io_append);
			fwrite(file, pos);
			fclose(file);
		}
	}
	return 1;
}

public OnFilterScriptInit()
{
	LoadGarages();
    return 1;
}

public OnPlayerConnect(playerid)
{
	RemoveBuildingForPlayer(playerid, 729, 476.7188, -1324.7891, 11.1172, 0.25);
	RemoveBuildingForPlayer(playerid, 1411, 426.9531, -1351.7500, 15.6797, 0.25);
	RemoveBuildingForPlayer(playerid, 1411, 431.3594, -1348.9375, 15.6797, 0.25);
	RemoveBuildingForPlayer(playerid, 1411, 435.7734, -1346.1172, 15.6797, 0.25);
	RemoveBuildingForPlayer(playerid, 1411, 444.6094, -1340.3906, 15.6797, 0.25);
	RemoveBuildingForPlayer(playerid, 1411, 440.1875, -1343.2500, 15.6797, 0.25);
    return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 100 && response)
    {
    	if (!strcmp("The State", GarageInfo[ChooseGarage[playerid]][Owner]))
    	{
    	    if(GetPlayerMoney(playerid) <GarageInfo[ChooseGarage[playerid]][Cost])
    	    {
    	    	SendClientMessage(playerid,-1,"{00CCFF}У вас нет необходимой суммы!");
    	    	return 1;
    	    }
    		GivePlayerMoney(playerid,-GarageInfo[ChooseGarage[playerid]][Cost]);
    		SendClientMessage(playerid,-1,"{00CCFF}Поздравляем с успешной покупкой гаража!");
    		strmid(GarageInfo[ChooseGarage[playerid]][Owner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);
			new s[256];
            format(s,sizeof(s),"{FC5C05}.::{02F23A}Гараж{FC5C05}::.\n {0004FF}Владелец{FC5C05}:{E8DB1E} %s \n{0004FF}Открыть{FC5C05}|{0004FF}закрыть{FC5C05}:{E8DB1E}/gate\n{0004FF}Продать{FC5C05}:{E8DB1E}/sellgarage",GarageInfo[ChooseGarage[playerid]][Owner]);
            Update3DTextLabelText(GarageInfo[ChooseGarage[playerid]][GarageText], 0xCCFFDDFF, s);
            UpdateGarages();
    	}
	}
	if(dialogid == 101 && response)
    {
    	for(new i; i< CountGarages; i++)
		{
	    	if (!strcmp(GarageInfo[i][Owner], PlayerName(playerid)))
	    	{
	    	    new model = GetVehicleModel(GetPlayerVehicleID(playerid));
	    	    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
	    	    SetPlayerPos(playerid,GarageInfo[i][StartX],GarageInfo[i][StartY],GarageInfo[i][StartZ]-0.5);
				DestroyVehicle(GarageInfo[i][Car]);
				GarageInfo[i][VehID] = model;
				GarageInfo[i][Car] = CreateVehicle(GarageInfo[i][VehID],GarageInfo[i][SpawnCarX],GarageInfo[i][SpawnCarY],GarageInfo[i][SpawnCarZ],GarageInfo[i][SpawnCarA],-1, -1, 300);
				UpdateGarages();
				return 1;
			}
		}
	}
	return 0;
}
        
public OnPlayerPickUpPickup(playerid, pickupid)
{
	for(new i; i< CountGarages; i++)
	{
	    if(pickupid == GarageInfo[i][CarPickup])
	    {
	    	DestroyPickup(GarageInfo[i][CarPickup]);
	    	GarageInfo[i][CarPickup] = CreatePickup(0, 14, GarageInfo[i][SpawnCarX],GarageInfo[i][SpawnCarY],GarageInfo[i][SpawnCarZ], -1);
	    	if (!strcmp(GarageInfo[i][Owner], PlayerName(playerid)))
	    	{
            	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) != GarageInfo[i][Car])
            	{
            		ShowPlayerDialog(playerid, 101, DIALOG_STYLE_MSGBOX, "{ffff00}Установка авто","{00CCFF}Вы хотите поставить это авто в гараж?", "Ок", "Отмена");
            	}
	    	}
	    }
		if(pickupid == GarageInfo[i][GaragePickup])
		{
			if (!strcmp("The State", GarageInfo[i][Owner]))
			{
	    		for(new j; j<CountGarages; j++)
				{
					if (!strcmp(GarageInfo[j][Owner], PlayerName(playerid)))
  					{
    					SendClientMessage(playerid,-1,"{00CCFF}У вас уже есть Гараж! Продайте его /sellgarage");
	        			return 1;
	 				}
 				}
				ChooseGarage[playerid] = i;
				new s[128];
				format(s,sizeof(s),"{00CCFF}Вы хотите купить гараж за $%d?",GarageInfo[i][Cost]);
 				ShowPlayerDialog(playerid, 100, DIALOG_STYLE_MSGBOX, "{ffff00}Покупка гаража",s, "Ок", "Отмена");
			}
			break;
		}
	}
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	for(new i; i<CountGarages; i++)
	{
		if (!strcmp(GarageInfo[i][Owner], PlayerName(playerid)))
		{
			GarageInfo[i][StatusGate] = 0;
 			MoveObject(GarageInfo[i][GarageDoor], GarageInfo[i][StartX], GarageInfo[i][StartY], GarageInfo[i][StartZ], 1.00, GarageInfo[i][StartRX], GarageInfo[i][StartRY], GarageInfo[i][StartRZ]);
			break;
		}
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], idx;//, tmp[256];
    cmd = strtok(cmdtext, idx);
    if(!strcmp(cmd,"/gate",true))
 	{
		for(new i; i<CountGarages; i++)
		{
			if (!strcmp(GarageInfo[i][Owner], PlayerName(playerid)))
  			{
				if(GarageInfo[i][StatusGate] == 0)
				{
				    MoveObject(GarageInfo[i][GarageDoor], GarageInfo[i][EndX], GarageInfo[i][EndY], GarageInfo[i][EndZ], 1.00, GarageInfo[i][EndRX], GarageInfo[i][EndRY], GarageInfo[i][EndRZ]);
					GarageInfo[i][StatusGate] = 1;
				}
				else
				{
					GarageInfo[i][StatusGate] = 0;
				 	MoveObject(GarageInfo[i][GarageDoor], GarageInfo[i][StartX], GarageInfo[i][StartY], GarageInfo[i][StartZ], 1.00, GarageInfo[i][StartRX], GarageInfo[i][StartRY], GarageInfo[i][StartRZ]);
				}
				return 1;
			}
		}
		SendClientMessage(playerid,-1,"{00CCFF}У вас нет гаража!");
		return 1;
 	}
  	if(!strcmp(cmd,"/sellgarage",true))
 	{
		for(new i; i<CountGarages; i++)
		{
			if (!strcmp(GarageInfo[i][Owner], PlayerName(playerid)))
  			{
				strmid(GarageInfo[i][Owner], "The State", 0, strlen("The State"), 255);
				SendClientMessage(playerid,-1,"{00CCFF}Поздравляем с успешной продажей гаража!");
				new s[256];
				format(s,256,"{FC5C05}.::{02F23A}Гараж{FC5C05}::.\n{0004FF}Продается!{E8DB1E}цена{FC5C05}:{E8DB1E}$%d{AA22EE}",GarageInfo[i][Cost]);
				GivePlayerMoney(playerid,GarageInfo[i][Cost]);
				Update3DTextLabelText(GarageInfo[i][GarageText], 0xCCFFDDFF, s);
				GarageInfo[i][StatusGate] = 0;
		 		MoveObject(GarageInfo[i][GarageDoor], GarageInfo[i][StartX], GarageInfo[i][StartY], GarageInfo[i][StartZ], 1.00, GarageInfo[i][StartRX], GarageInfo[i][StartRY], GarageInfo[i][StartRZ]);
				UpdateGarages();
				return 1;
			}
		}
		SendClientMessage(playerid,-1,"{00CCFF}У вас нет гаража!");
		return 1;
  	}
	return 0;
}

public split(const strsrc[], strdest[][], delimiter)
{
	new i, li;
	new aNum;
	new len;

	while(i <= strlen(strsrc)){
	    if(strsrc[i]==delimiter || i==strlen(strsrc)){
	        len = strmid(strdest[aNum], strsrc, li, i, 128);
	        strdest[aNum][len] = 0;
	        li = i+1;
	        aNum++;
		}
		i++;
	}
	return 1;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' ')) index++;
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

stock PlayerName(playerid) {
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
return pname; }

Благодаря этому .pwn файлу, мы можем настроить систему работы гаража, но для этого нам потребуются навыки программирования в Pawno.

Рекомендуем воспользоваться услугами качественного игрового хостера, который гарантирует стабильную работу вашего сервера. http://evehost.ru/

Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь. Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.