Cesare228
Ученик
Всем привет!
Нашол мод под названием "Connected RP".И решил вырезать систему что бы летать без собейта.
Ко всем #define
В public OnPlayerConnect(playerid)
Команды
В public OnPlayerRequestSpawn(playerid
В public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
В public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Создайте "void Update(playerid)"
И засуньте это туда.
Вот и всё,будут вопросы пишите.
Нашол мод под названием "Connected RP".И решил вырезать систему что бы летать без собейта.
Ко всем #define
PHP:
#define FLYMODESPEED GetPVarFloat(playerid, "FlymodeSpeed")
PHP:
SetPVarFloat(playerid, "FlymodeSpeed", 0.5);
PHP:
COMMAND:fly(playerid, params[])
{
if(PlayerLogin[playerid] != 1) return 1;
if(Player[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_WHITE, "Вам не доступна данная функция");
if(GetPVarInt(playerid, "Flymode") == 0)
{
SetPVarInt(playerid, "Flymode", 1);
SetPlayerHealth(playerid, 50000);
SendClientMessage(playerid, 0xAA634700, "Fly {FFFFFF}Активирован");
TextDrawShowForPlayer(playerid,flyinfo); TextDrawShowForPlayer(playerid,flykeys);
return 1;
}
if(GetPVarInt(playerid, "Flymode") == 1)
{
SetPVarInt(playerid, "Flymode", 0);
ClearAnimations(playerid);
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, 0xAA634700, "Fly {FFFFFF}Деактивирован");
TextDrawHideForPlayer(playerid, flyinfo); TextDrawHideForPlayer(playerid, flykeys);
return 1;
}
return 1;
}
COMMAND:flyspeed(playerid, params[])
{
if(PlayerLogin[playerid] != 1) return 1;
if(Player[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_WHITE, "Вам не доступна данная функция");
ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Сменить скорость полета", "Пожалуйста, введите сюда скорость полёта:\n\n", "Ввод", "Отмена");
return 1;
}
PHP:
SetPVarFloat(playerid, "FlymodeSpeed", 1);
PHP:
if((newkeys & KEY_JUMP) && !(oldkeys & KEY_JUMP)) // Ôëàéõàê
{
new Float:x,Float:y,Float:z;
if(GetPVarInt(playerid, "Flymode") == 1)
{
if(GetPVarInt(playerid, "Flying") == 0) return SetPVarInt(playerid, "Flying", 1);
if(GetPVarInt(playerid, "Flying") == 1)
{
SetPVarInt(playerid, "Flying", 0);
GetPlayerVelocity(playerid, x, y, z);
ClearAnimations(playerid);
SetPlayerVelocity(playerid, x/2, y/2, z/2);
return 1;
}
}
}
PHP:
if(GetPVarInt(playerid, "Flymode") == 1)
{
new Float:x,Float:y,Float:z;
GetPlayerVelocity(playerid, x, y, z);
SetPlayerVelocity(playerid, x, y, z+FLYMODESPEED);
}
PHP:
case 101: // Скорость полета (FlyMod)
{
if(!response && !strlen(inputtext)) return 1;
new Float:speed;
if (sscanf(inputtext, "f", speed)) SendClientMessage(playerid, COLOR_WHITE, "Введите корректный номер");
else SetPVarFloat(playerid, "FlymodeSpeed", speed), SendClientMessage(playerid, COLOR_WHITE, "Скорость изменена");
}
И засуньте это туда.
PHP:
new Float:x,Float:y,Float:z;
new Float:x2, Float:y2, Float:z2;
if(GetPVarInt(playerid, "Flymode") == 1 && GetPVarInt(playerid, "Flying") == 1)
{
GetPlayerKeys(playerid, PlayerToetsen, OmhoogLaag, LinksRechts);
if(PlayerToetsen & KEY_SPRINT)
{
GetPlayerPos(playerid, x2, y2, z2);
GetPlayerCameraFrontVector(playerid, x, y, z);
SetPlayerToFacePos(playerid, x + x2, y+y2);
SetPlayerVelocity(playerid, x*FLYMODESPEED, y*FLYMODESPEED, z*FLYMODESPEED);
ApplyAnimation(playerid,"PED","run_player", 4.1, 1, 1, 1, 1, 0, 1);
}
else
{
SetPlayerVelocity(playerid, 0, 0, 0);
ApplyAnimation(playerid,"FAT","FatIdle", 4.1, 0, 1, 1, 1, 0, 1);
}
if(PlayerToetsen & KEY_WALK)
{
GetPlayerVelocity(playerid, x, y, z);
SetPlayerVelocity(playerid, x, y, z+FLYMODESPEED);
}
}
