GTAMulti - GTA Türkiye

San Andreas Multiplayer => PAWN Kodlama => Mod Galerisi => Konuyu başlatan: Flash2024 - 14 Nisan 2018, 13:33:46

Başlık: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: Flash2024 - 14 Nisan 2018, 13:33:46
Öncelikle Merhaba, Bu Açlık Oyunları Sistemini Bir Forumda Gördüm Bazı Hataları Vardı Kapatmak İstedim Umarım Çalışır ve işinize Yarar.
Özellikler:
Açlık Oyunlarına daha fazla oyuncu katılabilir.
5 Dakika Zamanlayıcı (ayarlayabilirsiniz).
Son adam ayakta = kazanır (bir sonraki güncelleme ödülünü alacağım).
Hiçbir oyuncu / joingame yapmadıysa - zamanlayıcı 5 dakikaya resetlenir.


Sık Sorulan Sorular


S: Zamanlayıcı nasıl ayarlanır?
A: http://lmgtfy.com/?q=how+much+5+minutes+in+seconds İstediğiniz dakikalara 5 değiştirin.
Sonucu aldığınızdan ve 0'a kadar aldığınızdan emin olun.

S: Bir hata buldum, ne yapacağım?
A: Sadece yorumlayın, düzelteceğim.

S: Bu filtercript ile ilgili güncellemeler yapıyor musunuz?
A: Evet. Özellikle ödül vereceğim.


PAWN Kodu: Seç
#include <a_samp>
#include <core>
#include <float>

new HungerGames;
new InHG[MAX_PLAYERS];
new Count=300;
new HGTimer;
new Text3D:HGLabel;
new HGJoin;

forward TestFunction(playerid);
forward Heartbeat();

#pragma tabsize 0

main()
{
print("\n----------------------------------");
print("  Bare Script\n");
print("----------------------------------\n");
}

public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script | ~lr~Hunger ~g~Games",5000,5);
InHG[playerid] = 0;
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];

cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/joingame", true) == 0) {
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1957.14, 1342.81, 15.37))
{
if(HungerGames == 0)
{
    if(InHG[playerid] == 2)
    {
        SendClientMessage(playerid, -1, "You are already a participant! Please wait the timer.");
        return 1;
}
else if(InHG[playerid] == 1)
{
    SendClientMessage(playerid, -1, "You are already in Hunger Games.");
        return 1;
}
SendClientMessage(playerid, -1, "You have joined the hunger games as a participant. Please wait until the timer.");
HGJoin++;
InHG[playerid] = 2;
                new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z); // Get the players position
    SetPVarFloat(playerid,"xpos",x); // Save the float into a player variable
    SetPVarFloat(playerid,"ypos",y); // Save the float into a player variable
    SetPVarFloat(playerid,"zpos",z); // Save the float into a player variable
}
else
{
    SendClientMessage(playerid, -1, "Round in progress! Try again later!");
}
}
else
{
    SendClientMessage(playerid, -1, "You are not near the Hunger Games entrance! (Santa Maria Beach)");
}
return 1;
}
return 0;
}

public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
TogglePlayerClock(playerid,0);
return 1;
}

public Heartbeat()
{
new string[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(InHG[i] == 1)
{
    if(HGJoin == 1)
    {
        new killername[MAX_PLAYER_NAME];
    GetPlayerName(i, killername, MAX_PLAYER_NAME);
    format(string, sizeof(string), "Congratulations to %s for winning a round of Hunger Games!", killername);
  SetPlayerPos(i, GetPVarFloat(i,"xpos"), GetPVarFloat(i,"ypos"), GetPVarFloat(i,"zpos"));
KillTimer(HGTimer);
    HGTimer = SetTimer("TestFunction", 1000, 1);
    Delete3DTextLabel(HGLabel);
    HGLabel = Create3DTextLabel("{FFFF00}The Hunger Games\nStarting in 5 minutes\n/joingame", -1, 1957.14, 1342.81, 15.37, 10.0, 0, 0);
  return SendClientMessageToAll(-1, string);
}
}
else if(InHG[i] == 2)
{
if(!IsPlayerInRangeOfPoint(i, 10.0, 1957.14, 1342.81, 15.37))
{
    SendClientMessage(i, -1, "You have been removed as a participant of hunger games for leaving out boundaries.");
    InHG[i] = 0;
}
}
}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
new string[128];
if(InHG[playerid] == 1 || InHG[killerid] == 1)
{
if(HGJoin == 1)
{
    new killername[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killername, MAX_PLAYER_NAME);
    format(string, sizeof(string), "Congratulations to %s for winning a round of Hunger Games!", killername);
    KillTimer(HGTimer);
    HGTimer = SetTimer("TestFunction", 1000, 1);
    Delete3DTextLabel(HGLabel);
    HGLabel = Create3DTextLabel("{FFFF00}The Hunger Games\nStarting in 5 minutes\n/joingame", -1, 1957.14, 1342.81, 15.37, 10.0, 0, 0);

  SetPlayerPos(killerid, GetPVarFloat(killerid,"xpos"), GetPVarFloat(killerid,"ypos"), GetPVarFloat(killerid,"zpos"));
return 1;
}
SetPlayerPos(playerid, GetPVarFloat(playerid,"xpos"), GetPVarFloat(playerid,"ypos"), GetPVarFloat(playerid,"zpos"));
SendClientMessage(playerid, -1, "You have died in Hunger Games. Come back again!");
InHG[playerid] = 0;
HGJoin--;
}
    return 1;
}

SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,14);
SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerRequestClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid);
return 1;
}

public TestFunction(playerid)
{
Count--;
if(Count == 240)
{
Update3DTextLabelText(HGLabel, -1, "{FFFF00}The Hunger Games\nStarting in 4 minutes\n/joingame");
return 1;
}
else if(Count == 180)
{
Update3DTextLabelText(HGLabel, -1, "{FFFF00}The Hunger Games\nStarting in 3 minutes\n/joingame");
return 1;
}
else if(Count == 120)
{
Update3DTextLabelText(HGLabel, -1, "{FFFF00}The Hunger Games\nStarting in 2 minutes\n/joingame");
return 1;
}
else if(Count == 60)
{
Update3DTextLabelText(HGLabel, -1, "{FFFF00}The Hunger Games\nStarting in 1 minutes\n/joingame");
return 1;
}
else if(Count == 0)
{
    if(HGJoin >= 1)
    {
Update3DTextLabelText(HGLabel, -1, "{FFFF00}The Hunger Games\nRound in progress!\nTry again later");
KillTimer(HGTimer);

for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(InHG[i] == 2)
    {
InHG[i] = 1;
SetPlayerPos(i, 2199.84, 100.41, 86.25);
SendClientMessage(i, -1, "May the odds be ever in your favor!");
}
}
}
else
{
KillTimer(HGTimer);
    HGTimer = SetTimer("TestFunction", 1000, 1);
    Delete3DTextLabel(HGLabel);
    HGLabel = Create3DTextLabel("{FFFF00}The Hunger Games\nStarting in 5 minutes\n/joingame", -1, 1957.14, 1342.81, 15.37, 10.0, 0, 0);
}
return 1;
}
return 1;
}

public OnGameModeInit()
{
SetGameModeText("Exodus Roleplay");
ShowPlayerMarkers(1);
ShowNameTags(1);
AllowAdminTeleport(1);
HGTimer = SetTimer("TestFunction", 1000, 1);
SetTimer("Heartbeat", 1000, 1);
AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
HungerGames=0;
HGJoin=0;
printf("TIMER STARTED");
HGLabel = Create3DTextLabel("{FFFF00}The Hunger Games\nStarting in 5 minutes\n/joingame", -1, 1957.14, 1342.81, 15.37, 10.0, 0, 0);
return 1;
}

strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <=    ))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] >    ) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}


Kodlarda Hata - Açık Vs. Alan Varsa Yorumlarda Belirtsin Teşekkürler..
Başlık: Ynt: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: rootcause_ - 14 Nisan 2018, 13:35:46
Yine alıntı yapmışsın.
Başlık: Ynt: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: Flash2024 - 14 Nisan 2018, 13:38:17
Alıntı yapılan: Fonsy - 14 Nisan 2018, 13:35:46

Yine alıntı yapmışsın.




Konu Düzeltilmiştir.. Bazı Hataları Kapatıldı sadece.
Başlık: Ynt: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: ServerBey. - 14 Nisan 2018, 14:16:33
Düzelttiğin hataları da belirtir misin konu altında :)
Başlık: Ynt: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: Flash2024 - 14 Nisan 2018, 14:44:16
Alıntı yapılan: ServerBey. - 14 Nisan 2018, 14:16:33

Düzelttiğin hataları da belirtir misin konu altında :)



.pwn Dosyasında Bazı İnclude vs. hataları oldu klasik hatalar onları Düzelttim fazla bir hata olmadığı için konu başlığı altında paylaşmak istemedim değerli yorumun için teşekkürler... [ bu aralar çok üstüme geliyon] :D
Başlık: Ynt: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: kelly - 03 Haziran 2018, 09:10:54
Paylaştığın için teşekkürler.
Başlık: Ynt: SA:MP Açlık Oyunları Soru-Cevap [2024 Studio™]
Gönderen: Flash2024 - 03 Haziran 2018, 12:59:12
Alıntı yapılan: kelly - 03 Haziran 2018, 09:10:54

Paylaştığın için teşekkürler.


Rica Ederim Yorumun için sağol