Няшка*
Умник
Здравствуйте.Вот делал систему подносов с едой для своего сервера и решил поделится с вами.
Ну что ж начнем:
Ко всем define:
Ко всем переменным:
в public OnPlayerKeyStateChange:
в public OnPlayerCommandText:
В public OnGameModeInit:
в public OnPlayerPickUpPickup:
Скрины:
Вот и всё....
Автор:Няшка*
Ну что ж начнем:
Ко всем define:
PHP:
#define MAX_PODNOS 125
#define GOLD "{FFD700}"
PHP:
new eatresp;
new podnos[MAX_PLAYERS];
new Float:px,Float:py,Float:pz;
enum sInfo
{
Float: sBratX,
Float: sBratY,
Float: sBratZ,
Text3D: hLabel,
};
new PodnosInfo[MAX_PODNOS][sInfo];
new TOTAL_PODNOS;
PHP:
if(newkeys & KEY_SPRINT && newkeys & KEY_JUMP || newkeys == KEY_FIRE || newkeys & KEY_SECONDARY_ATTACK || (newkeys & KEY_SUBMISSION && newkeys & KEY_SECONDARY_ATTACK))
{
if(GetPVarInt(playerid, "respeat") == 1)
{
SendClientMessage(playerid, COL_WHITE, "Вы уронили поднос с едой!");
RemovePlayerAttachedObject(playerid,5);
GetPlayerPos(playerid,px,py,pz);
SetPVarInt(playerid, "respeat",0);
++ TOTAL_PODNOS;
podnos[TOTAL_PODNOS] = CreateObject(2355,px,py,pz-1,0.096313, 0.334523, -0.267872);
PodnosInfo[TOTAL_PODNOS][sBratX] = px;
PodnosInfo[TOTAL_PODNOS][sBratY] = py;
PodnosInfo[TOTAL_PODNOS][sBratZ] = pz;
PodnosInfo[TOTAL_PODNOS][hLabel] = Create3DTextLabel(""GOLD"Поднос с едой\nподнять /up", 0x008080AA, PodnosInfo[TOTAL_PODNOS][sBratX],PodnosInfo[TOTAL_PODNOS][sBratY],PodnosInfo[TOTAL_PODNOS][sBratZ], 20.0,0);
}
}
PHP:
if(strcmp(cmd, "/up", true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, PodnosInfo[TOTAL_PODNOS][sBratX],PodnosInfo[TOTAL_PODNOS][sBratY],PodnosInfo[TOTAL_PODNOS][sBratZ]))
{
if(GetPVarInt(playerid,"respeat")== 1) return SendClientMessage(playerid, COLOR_YELLOW, "У вас в руках уже есть поднос!");
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
SetPVarInt(playerid,"respeat",1);
DestroyObject(podnos[TOTAL_PODNOS]);
Delete3DTextLabel(PodnosInfo[TOTAL_PODNOS][hLabel]);
SetPlayerAttachedObject(playerid, 5, 2355, 1, 0.096313, 0.334523, -0.267872, 109.200798, 122.924514, 313.923736, 1.025472, 1.000000, 1.000000 );
SendClientMessage(playerid, COL_GREY, "Вы подняли бесплатную еду {6699ff}*/eat* {cecece}чтобы скушать!");
}
return true;
}
if(strcmp(cmd, "/eat", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(GetPVarInt(playerid,"respeat")== 0) return SendClientMessage(playerid, COLOR_YELLOW, "У вас нету еды в руках!");
SetPlayerHealth(playerid, 100);
ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,1,1);
if(IsPlayerAttachedObjectSlotUsed(playerid,5)) RemovePlayerAttachedObject(playerid,5);
format(strings, sizeof(strings), "* %s ест бесплатную еду для бомжей", PlayerName(playerid));
ProxDetector(30.0, playerid, strings, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPVarInt(playerid,"respeat",0);
ClearAnimations(playerid);
return 1;
}
return 1;
}
PHP:
eatresp = CreatePickup(2821, 23,1756.96,-1885.04,12.70);
PHP:
if(pickupid == eatresp)
{
if(PlayerInfo[playerid][pLevel] > 6) return SendClientMessage(playerid, COL_GREY, "Можно использовать до 6 уровня!");
if(GetPVarInt(playerid,"respeat")== 1) return SendClientMessage(playerid, COLOR_YELLOW, "У вас в руках уже есть поднос!");
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
SetPVarInt(playerid,"respeat",1);
SetPlayerAttachedObject(playerid, 5, 2355, 1, 0.096313, 0.334523, -0.267872, 109.200798, 122.924514, 313.923736, 1.025472, 1.000000, 1.000000 );
SendClientMessage(playerid, COL_GREY, "Вы взяли бесплатную еду для бомжей{6699ff}*/eat* {cecece}чтобы скушать!");
}
Автор:Няшка*
Последнее редактирование:
