PDA

View Full Version : [FilterScript] Jellyfisher


OKStyle
12/02/2012, 07:42 AM
Как бы нерационально это звучало, но работа "Собиратель медуз" в последнее время стала весьма популярна. В связи с тем, что один нехороший человек хочет поступить некрасиво и лишить хорошего человека заработка, я выкладываю реплику работы в паблик.

http://youtu.be/2diVqS7jqBA

В скрипте есть несколько настроек, они довольно просты.

Эта версия мне не очень нравится, поэтому о багах отписываемся, решаем как улучшить. Идеально - сделать так, как в оригинале, но я на их сервере не нашёл это место, увы...

#include <a_samp>
// Jellyfisher by O.K.Style™

#define DIALOG_ID 1

new JF_OBJ[17], JF_VEH[4], PU_JF1[31], PU_JF2[13], PU_JF3[2], Text3D:JF_Text;

public OnFilterScriptInit()
{
JF_OBJ[0] = CreateObject(16207, 483.6, -2682.9, -39.3, 0.0, 0.0, 210.0);
JF_OBJ[1] = CreateObject(16207, 501.6, -2801.5, -50.1, 0.0, 0.0, 66.0);
JF_OBJ[2] = CreateObject(1637, 462.1, -2733.5, 4.3, 0.0, 0.0, 64.0);
JF_OBJ[3] = CreateObject(672, 464.4, -2740.3, 4.6, 0.0, 0.0, 0.0);
JF_OBJ[4] = CreateObject(11556, 449.0, -2777.2, -4.0, 0.0, 0.0, 0.0);
JF_OBJ[5] = CreateObject(12990, 475.0, -2714.5, 0.5, 0.0, 0.0, 160.0);
JF_OBJ[6] = CreateObject(800, 450.4, -2732.4, 5.4, 0.0, 0.0, 0.0);
JF_OBJ[7] = CreateObject(647, 460.4, -2738.3, 6.3, 0.0, 0.0, 0.0);
JF_OBJ[8] = CreateObject(647, 456.8, -2736.8, 6.2, 0.0, 0.0, 0.0);
JF_OBJ[9] = CreateObject(647, 453.8, -2735.1, 6.1, 0.0, 0.0, 0.0);
JF_OBJ[10] = CreateObject(2114, 458.3, -2730.4, 3.6, 0.0, 0.0, 0.0);
JF_OBJ[11] = CreateObject(1280, 465.2, -2737.3, 4.5, 0.0, 0.0, 246.0);
JF_OBJ[12] = CreateObject(2116, 460.0, -2730.3, 3.3, 0.0, 0.0, 336.0);
JF_OBJ[13] = CreateObject(1010, 461.1, -2730.8, 4.1, 0.0, 0.0, 65.0);
JF_OBJ[14] = CreateObject(1010, 459.9, -2730.2, 4.1, 0.0, 0.0, 65.0);
JF_OBJ[15] = CreateObject(1010, 460.7, -2730.6, 4.1, 0.0, 0.0, 65.0);
JF_OBJ[16] = CreateObject(1010, 460.3, -2730.4, 4.1, 0.0, 0.0, 65.0);

JF_VEH[0] = CreateVehicle(473, 482.6511, -2705.5588, -0.6289, 342.9840, 56, 53, -1);
JF_VEH[1] = CreateVehicle(473, 480.0605, -2712.9277, 0.2264, 339.6306, 56, 53, -1);
JF_VEH[2] = CreateVehicle(473, 473.7720, -2702.3792, -0.6280, 344.7112, 56, 53, -1);
JF_VEH[3] = CreateVehicle(473, 470.7216, -2711.0269, -0.8032, 339.4247, 56, 53, -1);

PU_JF1[0] = CreatePickup(1602, 2, 477.1, -2780.1, -9.5, -1);
PU_JF1[1] = CreatePickup(1602, 2, 477.1, -2780.1, -9.5, -1);
PU_JF1[2] = CreatePickup(1602, 2, 451.5, -2786.4, -9.5, -1);
PU_JF1[3] = CreatePickup(1602, 2, 484.1, -2795.4, -9.5, -1);
PU_JF1[4] = CreatePickup(1602, 2, 500.4, -2782.4, -9.5, -1);
PU_JF1[5] = CreatePickup(1602, 2, 497.3, -2778.5, -0.1, -1);
PU_JF1[6] = CreatePickup(1602, 2, 493.9, -2767.9, -3.5, -1);
PU_JF1[7] = CreatePickup(1602, 2, 483.4, -2792.8, -17.7, -1);
PU_JF1[8] = CreatePickup(1602, 2, 477.0, -2785.5, -17.7, -1);
PU_JF1[9] = CreatePickup(1602, 2, 451.4, -2789.1, -17.7, -1);
PU_JF1[10] = CreatePickup(1602, 2, 446.1, -2804.4, -25.7, -1);
PU_JF1[11] = CreatePickup(1602, 2, 447.1, -2797.6, -25.7, -1);
PU_JF1[12] = CreatePickup(1602, 2, 452.7, -2804.0, -21.5, -1);
PU_JF1[13] = CreatePickup(1602, 2, 429.8, -2789.1, -21.5, -1);
PU_JF1[14] = CreatePickup(1602, 2, 413.3, -2782.5, -21.5, -1);
PU_JF1[15] = CreatePickup(1602, 2, 415.7, -2783.1, -8.5, -1);
PU_JF1[16] = CreatePickup(1602, 2, 412.7, -2777.7, -8.5, -1);
PU_JF1[17] = CreatePickup(1602, 2, 403.9, -2774.7, -8.5, -1);
PU_JF1[18] = CreatePickup(1602, 2, 398.6, -2760.2, -8.5, -1);
PU_JF1[19] = CreatePickup(1602, 2, 389.5, -2750.0, -8.5, -1);
PU_JF1[20] = CreatePickup(1602, 2, 397.2, -2741.0, -8.5, -1);
PU_JF1[21] = CreatePickup(1602, 2, 396.8, -2747.2, -15.5, -1);
PU_JF1[22] = CreatePickup(1602, 2, 389.9, -2748.8, -21.7, -1);
PU_JF1[23] = CreatePickup(1602, 2, 401.2, -2734.9, -21.7, -1);
PU_JF1[24] = CreatePickup(1602, 2, 416.3, -2705.4, -11.0, -1);
PU_JF1[25] = CreatePickup(1602, 2, 421.4, -2706.8, -11.0, -1);
PU_JF1[26] = CreatePickup(1602, 2, 455.3, -2692.2, -11.0, -1);
PU_JF1[27] = CreatePickup(1602, 2, 453.6, -2691.2, -19.5, -1);
PU_JF1[28] = CreatePickup(1602, 2, 446.0, -2686.8, -28.7, -1);
PU_JF1[29] = CreatePickup(1602, 2, 470.3, -2673.4, -32.5, -1);
PU_JF1[30] = CreatePickup(1602, 2, 476.0, -2677.6, -22.7, -1);

PU_JF2[0] = CreatePickup(1603, 2, 535.4, -2768.5, -20.7, -1);
PU_JF2[1] = CreatePickup(1603, 2, 536.4, -2752.5, -20.7, -1);
PU_JF2[2] = CreatePickup(1603, 2, 544.0, -2762.5, -25.5, -1);
PU_JF2[3] = CreatePickup(1603, 2, 544.0, -2762.5, -11.8, -1);
PU_JF2[4] = CreatePickup(1603, 2, 542.9, -2744.3, -11.8, -1);
PU_JF2[5] = CreatePickup(1603, 2, 547.7, -2745.0, -16.7, -1);
PU_JF2[6] = CreatePickup(1603, 2, 547.0, -2734.0, -16.7, -1);
PU_JF2[7] = CreatePickup(1603, 2, 546.4, -2725.0, -16.7, -1);
PU_JF2[8] = CreatePickup(1603, 2, 545.7, -2713.5, -16.7, -1);
PU_JF2[9] = CreatePickup(1603, 2, 536.9, -2700.8, -16.7, -1);
PU_JF2[10] = CreatePickup(1603, 2, 534.1, -2700.5, -25.0, -1);
PU_JF2[11] = CreatePickup(1603, 2, 540.1, -2716.4, -25.0, -1);
PU_JF2[12] = CreatePickup(1603, 2, 540.1, -2716.4, -25.0, -1);

PU_JF3[0] = CreatePickup(1239, 23, 461.0112, -2729.4014, 4.1631, -1); // Aqualung
PU_JF3[1] = CreatePickup(1239, 23, 397.3723, -1757.7983, 8.2065, -1); // Seller

JF_Text = Create3DTextLabel("Продавец медуз", 0x8fa455FF, 397.3723, -1757.7983, 8.2065, 40.0, 0, 0);
return 1;
}
public OnFilterScriptExit()
{
for(new i; i < sizeof(JF_OBJ); i++) DestroyObject(JF_OBJ[i]);
for(new i; i < sizeof(JF_VEH); i++) DestroyVehicle(JF_VEH[i]);
for(new i; i < sizeof(PU_JF1); i++) DestroyPickup(PU_JF1[i]);
for(new i; i < sizeof(PU_JF2); i++) DestroyPickup(PU_JF2[i]);
for(new i; i < sizeof(PU_JF3); i++) DestroyPickup(PU_JF3[i]);
Delete3DTextLabel(JF_Text);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == PU_JF1[0] || pickupid == PU_JF1[1] || pickupid == PU_JF1[2]
|| pickupid == PU_JF1[3] || pickupid == PU_JF1[4] || pickupid == PU_JF1[5]
|| pickupid == PU_JF1[6] || pickupid == PU_JF1[7] || pickupid == PU_JF1[8]
|| pickupid == PU_JF1[9] || pickupid == PU_JF1[10] || pickupid == PU_JF1[11]
|| pickupid == PU_JF1[12] || pickupid == PU_JF1[13] || pickupid == PU_JF1[14]
|| pickupid == PU_JF1[15] || pickupid == PU_JF1[16] || pickupid == PU_JF1[17]
|| pickupid == PU_JF1[18] || pickupid == PU_JF1[19] || pickupid == PU_JF1[20]
|| pickupid == PU_JF1[21] || pickupid == PU_JF1[22] || pickupid == PU_JF1[23]
|| pickupid == PU_JF1[24] || pickupid == PU_JF1[25] || pickupid == PU_JF1[26]
|| pickupid == PU_JF1[27] || pickupid == PU_JF1[28] || pickupid == PU_JF1[29]
|| pickupid == PU_JF1[30])
{
SetPVarInt(playerid, "WJF", GetPVarInt(playerid, "WJF") + 1);
GameTextForPlayer(playerid, "~w~+1 Jellyfish", 1000, 3);
}
if(pickupid == PU_JF2[0] || pickupid == PU_JF2[1] || pickupid == PU_JF2[2]
|| pickupid == PU_JF2[3] || pickupid == PU_JF2[4] || pickupid == PU_JF2[5]
|| pickupid == PU_JF2[6] || pickupid == PU_JF2[7] || pickupid == PU_JF2[8]
|| pickupid == PU_JF1[9])
{
SetPVarInt(playerid, "OJF", GetPVarInt(playerid, "OJF") + 1);
GameTextForPlayer(playerid, "~r~~h~+1 Jellyfish", 1000, 3);
}
if(pickupid == PU_JF3[0])
{
ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Остров медуз", "Что Вы хотите сделать с аквалангом?", "Надеть", "Снять");
}
else if(pickupid == PU_JF3[1])
{
new money = GetPVarInt(playerid, "WJF") * 10 + GetPVarInt(playerid, "OJF") * 15;
GivePlayerMoney(playerid, money);
new string[64];
format(string, sizeof(string), "~g~~h~+$%d", money);
GameTextForPlayer(playerid, string, 3000, 6);
DeletePVar(playerid, "OJF");
DeletePVar(playerid, "WJF");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ID)
{
if(!response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, 1);
}
else if(response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) return 0;
SetPlayerAttachedObject(playerid, 1, 1010, 1, 0.053070, -0.083673, -0.004646, 86.6, 354.2, 180.0, 1.0, 1.0, 1.0);
}
}
return 0;
}

sk47
12/02/2012, 07:57 AM
#include <a_samp>
// Jellyfisher by O.K.Style™

#define DIALOG_ID 1

new JF_OBJ[2], JF_VEH[2], PU_JF1[2], PU_JF2[2], PU_JF3[2], Text3D:JF_Text;

public OnFilterScriptInit()
{
JF_OBJ[0] = CreateObject(16207, 483.6, -2682.9, -39.3, 0.0, 0.0, 210.0);
CreateObject(16207, 501.6, -2801.5, -50.1, 0.0, 0.0, 66.0);
CreateObject(1637, 462.1, -2733.5, 4.3, 0.0, 0.0, 64.0);
CreateObject(672, 464.4, -2740.3, 4.6, 0.0, 0.0, 0.0);
CreateObject(11556, 449.0, -2777.2, -4.0, 0.0, 0.0, 0.0);
CreateObject(12990, 475.0, -2714.5, 0.5, 0.0, 0.0, 160.0);
CreateObject(800, 450.4, -2732.4, 5.4, 0.0, 0.0, 0.0);
CreateObject(647, 460.4, -2738.3, 6.3, 0.0, 0.0, 0.0);
CreateObject(647, 456.8, -2736.8, 6.2, 0.0, 0.0, 0.0);
CreateObject(647, 453.8, -2735.1, 6.1, 0.0, 0.0, 0.0);
CreateObject(2114, 458.3, -2730.4, 3.6, 0.0, 0.0, 0.0);
CreateObject(1280, 465.2, -2737.3, 4.5, 0.0, 0.0, 246.0);
CreateObject(2116, 460.0, -2730.3, 3.3, 0.0, 0.0, 336.0);
CreateObject(1010, 461.1, -2730.8, 4.1, 0.0, 0.0, 65.0);
CreateObject(1010, 459.9, -2730.2, 4.1, 0.0, 0.0, 65.0);
CreateObject(1010, 460.7, -2730.6, 4.1, 0.0, 0.0, 65.0);
JF_OBJ[1] = CreateObject(1010, 460.3, -2730.4, 4.1, 0.0, 0.0, 65.0);

JF_VEH[0] = CreateVehicle(473, 482.6511, -2705.5588, -0.6289, 342.9840, 56, 53, -1);
CreateVehicle(473, 480.0605, -2712.9277, 0.2264, 339.6306, 56, 53, -1);
CreateVehicle(473, 473.7720, -2702.3792, -0.6280, 344.7112, 56, 53, -1);
JF_VEH[1] = CreateVehicle(473, 470.7216, -2711.0269, -0.8032, 339.4247, 56, 53, -1);

PU_JF1[0] = CreatePickup(1602, 2, 477.1, -2780.1, -9.5, -1);
CreatePickup(1602, 2, 477.1, -2780.1, -9.5, -1);
CreatePickup(1602, 2, 451.5, -2786.4, -9.5, -1);
CreatePickup(1602, 2, 484.1, -2795.4, -9.5, -1);
CreatePickup(1602, 2, 500.4, -2782.4, -9.5, -1);
CreatePickup(1602, 2, 497.3, -2778.5, -0.1, -1);
CreatePickup(1602, 2, 493.9, -2767.9, -3.5, -1);
CreatePickup(1602, 2, 483.4, -2792.8, -17.7, -1);
CreatePickup(1602, 2, 477.0, -2785.5, -17.7, -1);
CreatePickup(1602, 2, 451.4, -2789.1, -17.7, -1);
CreatePickup(1602, 2, 446.1, -2804.4, -25.7, -1);
CreatePickup(1602, 2, 447.1, -2797.6, -25.7, -1);
CreatePickup(1602, 2, 452.7, -2804.0, -21.5, -1);
CreatePickup(1602, 2, 429.8, -2789.1, -21.5, -1);
CreatePickup(1602, 2, 413.3, -2782.5, -21.5, -1);
CreatePickup(1602, 2, 415.7, -2783.1, -8.5, -1);
CreatePickup(1602, 2, 412.7, -2777.7, -8.5, -1);
CreatePickup(1602, 2, 403.9, -2774.7, -8.5, -1);
CreatePickup(1602, 2, 398.6, -2760.2, -8.5, -1);
CreatePickup(1602, 2, 389.5, -2750.0, -8.5, -1);
CreatePickup(1602, 2, 397.2, -2741.0, -8.5, -1);
CreatePickup(1602, 2, 396.8, -2747.2, -15.5, -1);
CreatePickup(1602, 2, 389.9, -2748.8, -21.7, -1);
CreatePickup(1602, 2, 401.2, -2734.9, -21.7, -1);
CreatePickup(1602, 2, 416.3, -2705.4, -11.0, -1);
CreatePickup(1602, 2, 421.4, -2706.8, -11.0, -1);
CreatePickup(1602, 2, 455.3, -2692.2, -11.0, -1);
CreatePickup(1602, 2, 453.6, -2691.2, -19.5, -1);
CreatePickup(1602, 2, 446.0, -2686.8, -28.7, -1);
CreatePickup(1602, 2, 470.3, -2673.4, -32.5, -1);
PU_JF1[1] = CreatePickup(1602, 2, 476.0, -2677.6, -22.7, -1);

PU_JF2[0] = CreatePickup(1603, 2, 535.4, -2768.5, -20.7, -1);
CreatePickup(1603, 2, 536.4, -2752.5, -20.7, -1);
CreatePickup(1603, 2, 544.0, -2762.5, -25.5, -1);
CreatePickup(1603, 2, 544.0, -2762.5, -11.8, -1);
CreatePickup(1603, 2, 542.9, -2744.3, -11.8, -1);
CreatePickup(1603, 2, 547.7, -2745.0, -16.7, -1);
CreatePickup(1603, 2, 547.0, -2734.0, -16.7, -1);
CreatePickup(1603, 2, 546.4, -2725.0, -16.7, -1);
CreatePickup(1603, 2, 545.7, -2713.5, -16.7, -1);
CreatePickup(1603, 2, 536.9, -2700.8, -16.7, -1);
CreatePickup(1603, 2, 534.1, -2700.5, -25.0, -1);
CreatePickup(1603, 2, 540.1, -2716.4, -25.0, -1);
PU_JF2[1] = CreatePickup(1603, 2, 540.1, -2716.4, -25.0, -1);

PU_JF3[0] = CreatePickup(1239, 23, 461.0112, -2729.4014, 4.1631, -1); // Aqualung
PU_JF3[1] = CreatePickup(1239, 23, 397.3723, -1757.7983, 8.2065, -1); // Seller

JF_Text = Create3DTextLabel("Ïðîäàâåö ìåäóç", 0x8fa455FF, 397.3723, -1757.7983, 8.2065, 40.0, 0, 0);
return 1;
}
public OnFilterScriptExit()
{
for(new i = JF_OBJ[0]; i < JF_OBJ[1]; i++) DestroyObject(i);
for(new i = JF_VEH[0]; i < JF_VEH[1]; i++) DestroyVehicle(i);
for(new i = PU_JF1[0]; i < PU_JF1[1]; i++) DestroyPickup(i);
for(new i = PU_JF2[0]; i < PU_JF2[1]; i++) DestroyPickup(i);
for(new i = PU_JF3[0]; i < PU_JF3[1]; i++) DestroyPickup(i);
Delete3DTextLabel(JF_Text);
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid > PU_JF1[0] && pickupid < PU_JF1[1])
{
SetPVarInt(playerid, "WJF", GetPVarInt(playerid, "WJF") + 1);
GameTextForPlayer(playerid, "~w~+1 Jellyfish", 1000, 3);
}
if(pickupid > PU_JF2[0] && pickupid < PU_JF2[1])
{
SetPVarInt(playerid, "OJF", GetPVarInt(playerid, "OJF") + 1);
GameTextForPlayer(playerid, "~r~~h~+1 Jellyfish", 1000, 3);
}
if(pickupid == PU_JF3[0])
{
ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Îñòðîâ ìåäóç", "×òî Âû õîòèòå ñäåëàòü ñ àêâàëàíãîì?", "Íàäåòü", "Ñíÿòü");
}
else if(pickupid == PU_JF3[1])
{
new money = GetPVarInt(playerid, "WJF") * 10 + GetPVarInt(playerid, "OJF") * 15;
GivePlayerMoney(playerid, money);
new string[64];
format(string, sizeof(string), "~g~~h~+$%d", money);
GameTextForPlayer(playerid, string, 3000, 6);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ID)
{
if(!response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid, 1);
}
else if(response)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) return 0;
SetPlayerAttachedObject(playerid, 1, 1010, 1, 0.053070, -0.083673, -0.004646, 86.6, 354.2, 180.0, 1.0, 1.0, 1.0);
}
}
return 0;
}

White_116
12/02/2012, 09:59 AM
медуз лучше рандомить по координатам.
if(pickupid == PU_JF1[0] || pickupid == PU_JF1[1] || pickupid == PU_JF1[2]
по мне лучше цикл, так как можно выйти пораньше.

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid > PU_JF1[0] && pickupid < PU_JF1[1])
{
SetPVarInt(playerid, "WJF", GetPVarInt(playerid, "WJF") + 1);
GameTextForPlayer(playerid, "~w~+1 Jellyfish", 1000, 3);
}
if(pickupid > PU_JF2[0] && pickupid < PU_JF2[1])
{
SetPVarInt(playerid, "OJF", GetPVarInt(playerid, "OJF") + 1);
GameTextForPlayer(playerid, "~r~~h~+1 Jellyfish", 1000, 3);
}
if(pickupid == PU_JF3[0])
{
ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Îñòðîâ ìåäóç", "×òî Âû õîòèòå ñäåëàòü ñ àêâàëàíãîì?", "Íàäåòü", "Ñíÿòü");
}
else if(pickupid == PU_JF3[1])
{
new money = GetPVarInt(playerid, "WJF") * 10 + GetPVarInt(playerid, "OJF") * 15;
GivePlayerMoney(playerid, money);
new string[64];
format(string, sizeof(string), "~g~~h~+$%d", money);
GameTextForPlayer(playerid, string, 3000, 6);
}
return 1;
}
а если иды поменяться(полный рандом), то уже не работоспособно

OKStyle
12/02/2012, 10:19 AM
Там придётся ставить 2 цикла, а работать будет только последний.

BaTcoH
17/05/2012, 04:50 PM
После выдачи денег Pvar's то наверное нужно обнулить, иначе бессконечная прибыль.

else if(pickupid == PU_JF3[1])
{
new money = GetPVarInt(playerid, "WJF") * 10 + GetPVarInt(playerid, "OJF") * 15;
GivePlayerMoney(playerid, money);
new string[64];
format(string, sizeof(string), "~g~~h~+$%d", money);
SetPVarInt(playerid, "WJF", 0);
SetPVarInt(playerid, "OJF", 0);
GameTextForPlayer(playerid, string, 3000, 6);
}

А так впринципе все very good. Так держать)

OKStyle
21/05/2012, 03:34 PM
Добавил удаление PVar'ов, спс.

BaTcoH
11/07/2012, 03:16 PM
Попробуй сделать, что если анимка плавания и еще какие нибудь ограничения, то хп не убавляется, а то от акваланга смысла нуль.

OKStyle
11/07/2012, 04:09 PM
Кому надо - сами сделают.

Alexander_Petrov
11/07/2012, 04:22 PM
Почему бы не сделать рандомное создание медуз?
Создать переменную для всех пикапов и присваивать значение 1 при создании, а в OnPlayerPickUpPickup просто проверять значение этой переменной.

OKStyle
11/07/2012, 05:16 PM
Всё в ваших руках.