shape1
shape2
shape3
shape4
shape7
shape8

/setjob


Статус
Закрыто для дальнейших ответов.

MotoSport

Pawno-Crmp.Ru || Живи вечно!
Пользователь
08.03.2015
921
168
0
23
Команда поможет сменить работу игрока. 

Переменная new kisel;

И код:

Код:
	if(strcmp(cmd, "/setjob", true) == 0)
	{
		if(Offlineonline(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "* Используйте /setjob [ID] [ид работы]");
				return 1;
			}
			giveplayerid = strval(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "* Используйте /setjob [ID] [работко]");
				return 1;
			}
			kisel = strval(tmp);
			if(PlayerInfo[playerid][pAdmin] < 1)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "* Вы не админ");
				return 1;
			}
			if(kisel < 1 || kisel > 200)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "* Нету такой работы");
				return 1;
			}
			if (Offlineonline(giveplayerid))
			{
				if(giveplayerid != INVALID_PLAYER_ID)
				{
					SendClientMessage(playerid, COLOR_RED, "Вы сменили работу");
					PlayerInfo[giveplayerid][pJob] = kisel;
				}
			}
			else
			{
				format(string, sizeof(string), " %d ето не активный игрок.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
 

MADDD

Освоившийся
Пользователь
02.03.2015
181
25
0
27
Код:
	#define NetotID    SendClientMessage(playerid,COLOR_GRAD2, "Неверый ID игрока.")
	#define NoPlayerConnect 	SendClientMessage(playerid,COLOR_GRAD2, "Этот игрок не подключен к серверу.")

	if(strcmp(cmd, "/setjob", true) == 0)
	{
    	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_GRAD2,"Команда недоступна.");
    	tmp = strtok(cmdtext, idx);
    	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "* Используйте /setjob [ID] [ид работы]");
		giveplayerid = strval(tmp);
		tmp = strtok(cmdtext, idx);
    	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "* Используйте /setjob [ID] [работко]");
    	new kisel; kisel = strval(tmp);
    	if(kisel < 1 || kisel > 200) return SendClientMessage(playerid, COLOR_GRAD2, "* Нету такой работы");
    	if(!IsPlayerConnected(giveplayerid)) return NoPlayerConnect;
    	if(giveplayerid == INVALID_PLAYER_ID) return NetotID;
    	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Вы успешно сменили работу игроку.");
    	SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "Администратор сменил вам работу.");
    	PlayerInfo[giveplayerid][pJob] = kisel;
    	return 1;
	}
 

Sten

Unknown
Пользователь
08.05.2014
830
77
0
#define NetotID SendClientMessage(playerid,COLOR_GRAD2, "Неверый ID игрока.")
#define NoPlayerConnect SendClientMessage(playerid,COLOR_GRAD2, "Этот игрок не подключен к серверу.")

if(strcmp(cmd, "/setjob", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_GRAD2,"Команда недоступна.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "* Используйте /setjob [ID] [ид работы]");
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "* Используйте /setjob [ID] [работко]");
new kisel; kisel = strval(tmp);
if(kisel < 1 || kisel > 200) return SendClientMessage(playerid, COLOR_GRAD2, "* Нету такой работы");
if(!IsPlayerConnected(giveplayerid)) return NoPlayerConnect;
if(giveplayerid == INVALID_PLAYER_ID) return NetotID;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Вы успешно сменили работу игроку.");
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "Администратор сменил вам работу.");
PlayerInfo[giveplayerid][pJob] = kisel;
return 1;
}
Оптимизация рулит. Плюсанул за код.

 
Статус
Закрыто для дальнейших ответов.