Alvins
Ученик
Здравствуйте форумчане,у меня к вам 3 вопроса ..
1.Как перевести аккаунты на mysql с полным сохранением аккаутов (Урок,мануал если не трудно,РАБОЧИЙ!!)
2.Как сделать команду /heal с соглашение то есть (Ололоев предлагает вам вылечить вас на 100 хп за 100$)
3.Как сделать,чтобы когда игрок в афк отображались только секунды.
/heal
AFK System
1.Как перевести аккаунты на mysql с полным сохранением аккаутов (Урок,мануал если не трудно,РАБОЧИЙ!!)
2.Как сделать команду /heal с соглашение то есть (Ололоев предлагает вам вылечить вас на 100 хп за 100$)
3.Как сделать,чтобы когда игрок в афк отображались только секунды.
/heal
PHP:
//-----------------------------------[HEAL]-------------------------------------------------------------------------
if(strcmp(cmd, "/heal", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));
new location = PlayerInfo[playerid][pLocal];
if(!strlen(tmp))
{
if(location != 255)
{
if(location < 99)
{
if(HouseInfo[location][hArm] == 1)
{
SetPlayerArmorAC(playerid,100.0);
format(string, sizeof(string), "* %s надевает бронежилет.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
TogglePlayerControllable(playerid, 0);
GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
SetPlayerPos(playerid,1527.5,-12.1,1002.0);
PlayerInfo[playerid][pLocal] = 255;
SetPlayerInterior(playerid,99);
Spectate[playerid] = 257;
}
else
{
format(string, sizeof(string), "В этом доме нет модернизаций брони!");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
if(HouseInfo[location][hHel] == 1)
{
new Float:tempheal;
GetPlayerHealth(playerid,tempheal);
if ( tempheal < 100.0)
{
SetPlayerHealthAC(playerid,100.0);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Вы были излечены к 100 здоровью.");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
else
{
SendClientMessage(playerid, TEAM_GREEN_COLOR,"Вы уже излечены к 100-HP!");
}
}
else
{
format(string, sizeof(string), "У этого дома нету модернизаций аптечки!");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
return true;
}
else if(PlayerInfo[playerid][pPhousekey] == location)
{
if(HouseInfo[location][hArm] == 1)
{
SetPlayerArmorAC(playerid,100.0);
format(string, sizeof(string), "* %s надевает бронежилет.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
TogglePlayerControllable(playerid, 0);
GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
SetPlayerPos(playerid,1527.5,-12.1,1002.0);
PlayerInfo[playerid][pLocal] = 255;
SetPlayerInterior(playerid,99);
Spectate[playerid] = 257;
}
else
{
format(string, sizeof(string), "В этом доме нет модернизаций брони!");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
if(HouseInfo[location][hHel] == 1)
{
new Float:tempheal;
GetPlayerHealth(playerid,tempheal);
if ( tempheal < 100.0)
{
SetPlayerHealthAC(playerid,100.0);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Вы были излечены к 100 здоровью.");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
else
{
SendClientMessage(playerid, TEAM_GREEN_COLOR,"Вы уже излечены к 100-HP!");
}
}
else
{
format(string, sizeof(string), "У этого дома нету модернизаций аптечки!");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
return true;
}
else if(location == 101)//Restaurant
{
new Float:tempheal;
GetPlayerHealth(playerid,tempheal);
if ( tempheal < 100.0)
{
SetPlayerHealthAC(playerid,100.0);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Вы были излечены до 100 здоровья.");
SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
}
else
{
SendClientMessage(playerid, TEAM_GREEN_COLOR,"Вы уже излечены к 100-HP!");
}
}
else if(location == 102)//Police Armoury
{
SetPlayerHealthAC(playerid,100.0);
format(string, sizeof(string), "* %s надевает бронежилет.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,0,0);
TogglePlayerControllable(playerid, 0);
GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
SetPlayerPos(playerid,1527.5,-12.1,1002.0);
PlayerInfo[playerid][pLocal] = 255;
SetPlayerInterior(playerid,99);
Spectate[playerid] = 257;
SetPlayerArmorAC(playerid,100.0);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "{b3f9b0}• {FFFFFF} /heal [ID игрока/ЧастьИмени] [Цена]");
return true;
}
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{b3f9b0}• {FFFFFF} /heal [ID игрока/ЧастьИмени] [Цена]");
return true;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, " Исцеление цены не ниже 1 и не выше 1000!"); return true; }
if (giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GRAD1, " Вы не можете излечить себя!");
return true;
}
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new giveambu = GetPlayerVehicleID(giveplayerid);
new playambu = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)//model
{
if (IsAnAmbulance(playambu) && playambu == giveambu)
{
new Float:tempheal;
GetPlayerHealth(giveplayerid,tempheal);
if(tempheal >= 100.0)
{
SendClientMessage(playerid, TEAM_GREEN_COLOR," Тот человек полностью излечен!");
return true;
}
format(string, sizeof(string), "~y~You healed ~n~~w~%s~n~~g~$%d", giveplayer,moneys);
GameTextForPlayer(playerid, string, 5000, 1);
NormMoney[playerid] = 2;
AntiMoney[playerid] = AntiMoney[playerid] + moneys;
GiveMoney(playerid,moneys);
NormMoney[giveplayerid] = 2;
AntiMoney[giveplayerid] = AntiMoney[giveplayerid] - moneys;
GiveMoney(giveplayerid,-moneys);
new hp = 0;
if(PlayerInfo[playerid][pPainPerk] > 0)
{
hp = 20 * PlayerInfo[playerid][pPainPerk]; hp += 100;
SetPlayerHealthAC(giveplayerid, hp);
}
else
{
hp = 100;
SetPlayerHealthAC(giveplayerid, 100);
}
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
format(string, sizeof(string), " Вы были вылечены до %d HP за %d$",hp,moneys);
SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string);
if(STDPlayer[giveplayerid] > 0)
{
STDPlayer[giveplayerid] = 0;
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Вас вылечили!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Один из Вас не находится в Санитарной машине / Вертолет !");
return true;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Вы не уполномочены использовать эту команду !");
return true;
}
}
}
else
{
format(string, sizeof(string), "Игрок не в сети");
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return true;
}
AFK System
PHP:
stock ConvertSeconds(time)
{
new string[128];
if(time < 60) format(string, sizeof(string), "%d секунд", time);
else if(time == 60) string = "1 минуту";
else if(time > 60 && time < 3600)
{
new Float: minutes;
new seconds;
minutes = time / 60;
seconds = time % 60;
format(string, sizeof(string), "%.0f минут и %d секунд", minutes, seconds);
}
else if(time == 3600) string = "1 час";
else if(time > 3600)
{
new Float: hours;
new minutes_int;
new Float: minutes;
new seconds;
hours = time / 3600;
minutes_int = time % 3600;
minutes = minutes_int / 60;
seconds = minutes_int % 60;
format(string, sizeof(string), "%.0f:%.0f:%d", hours, minutes, seconds);
}
return string;
}
