GTAMulti.com - Türkiye'nin Türkçe GTA Sitesi

Oto Mesaj Sistemi Sorun

Başlatan xXDieForGameXx, 03 Mayıs 2017, 12:28:37

« önceki - sonraki »

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

xXDieForGameXx

Arkadaşlar ben bir tane fs aldım netten onu türkçeleştirip birkaç bug düzeltmesi yaptım fakat mesaj ekleye basıyorum mesaj gelmiyor.Nasıl düzeltebilirim?  :allaalla:

Kodlar:

#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#define MAX_TEXT_SIZE 128
#define MAX_MSG 25
#define MSG_FILE "messages.ini"

forward RandMsg();
new MsgIndex[MAX_MSG][MAX_TEXT_SIZE];
new pOnMsg[MAX_PLAYERS];
new Cooldown = 60;
new Prefix[30];
new send[MAX_TEXT_SIZE];
new Timer;

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Random Mesaj Yüklendi Bu fs xXDieForGameXx Tarafından Türkçeleştirilmiştir");
    print(" Bu fs xXDieForGameXx Tarafından Türkçeleştirilmiştir");
    print("--------------------------------------\n");
    if(!fexist(MSG_FILE))
    {
        fcreate(MSG_FILE);
        new string[6];
        format(string,6,"%d",Cooldown);
        fstrset(MSG_FILE,"Süre",string);
        format(Prefix, 30, "{FFE100}[xXRMSJXx]");
        fstrset(MSG_FILE,"Prefix",Prefix);
    }
    else ReloadConfig();
    ReloadMessages();
    Timer = SetTimer("xXRMSJXx", Cooldown*1000, true);
    return 1;
}

public OnFilterScriptExit() { KillTimer(Timer); return 1; }

public RandMsg()
{
    new rand = random(GetMessagesCount());
    if(rand == GetMessagesCount()) rand--;
    format(send, MAX_TEXT_SIZE, "%s {FFFFFF}%s", Prefix, MsgIndex[rand]);
    SendClientMessageToAll(-1, send);
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 111:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0: ShowPlayerDialog(playerid, 112, DIALOG_STYLE_INPUT, "{2BFF00}Yeni Mesaj Ekle", "{23CF00}Yeni Mesaj Eklemek İçin Seç", "Ekle", "Geri");
                    case 1: ShowPlayerDialog(playerid, 114, DIALOG_STYLE_INPUT, "{2BFF00}Süre - Dakika", "{23CF00}Süre-Dakika Değiştirmek İçin Seçiniz", "Seç", "Geri");
                    case 2: ShowPlayerDialog(playerid, 115, DIALOG_STYLE_INPUT, "{2BFF00}Tag", "{23CF00}Oto Mesaj Tagını Değiştirir", "Seç", "Geri");
                    default:
                    {
                        new msg[20]; format(msg, sizeof(msg), "Mesaj%d", listitem-2);
                        new str[200]; format(str, sizeof(str), "{23CF00}Mesajı Değiştirmeyi Seçtiniz\n{9E9E9E}Mesaj %d: {99C98F}%s", listitem-2, fstr(MSG_FILE, msg));
                        ShowPlayerDialog(playerid, 113, DIALOG_STYLE_INPUT, "{2BFF00}Mesajı Değiştir", str, "Seç", "Geri");
                        pOnMsg[playerid] = listitem-2;
                    }
                }
            }
            return 1;
        }
        case 112:
        {
            if(!response) return ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
            if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, 112, DIALOG_STYLE_INPUT, "{2BFF00}Yeni Mesaj Ekle", "{23CF00}Yeni Mesaj Eklemeyi Seçin e\n{FF0000}Mesajınızın En Az 6 Karakterli Olması Gerekir", "Ekle", "Geri");
            new msg[20]; format(msg, sizeof(msg), "Message%d", GetMessagesCount()+1);
            fstrset(MSG_FILE, msg, inputtext);
            ReloadMessages();
            ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
            return 1;
        }
        case 114:
        {
            if(!response) return ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
            if(!(IsNumeric(inputtext))) return ShowPlayerDialog(playerid, 114, DIALOG_STYLE_INPUT, "{2BFF00}Süre-Dakika", "{23CF00}Süreyi Değiştirmeyi Seçtiniz\n{FF0000}Süre En Az 1 Rakam Olmalıdır", "Değiştir", "Geri");
            Cooldown = strval(inputtext);
            new string[6];
            format(string,6,"%d",Cooldown);
            fstrset(MSG_FILE,"Cooldown",string);
            KillTimer(Timer);
            Timer = SetTimer("RandMsg", Cooldown*1000, true);
            ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}RRastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
            return 1;
        }
        case 115:
        {
            if(!response) return ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Select", "Cancel");
            if(strlen(inputtext) < 3) return ShowPlayerDialog(playerid, 115, DIALOG_STYLE_INPUT, "{2BFF00}Süre", "{23CF00}Tag Değiştirmeyi\n{FF0000}En Az 3 Karakterli Olması Gerekr", "Değiştir", "Geri");
            fstrset(MSG_FILE,"Prefix",inputtext);
            format(Prefix, 30, "%s", inputtext);
            ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "Cancel");
            return 1;
        }
        case 113:
        {
            if(!response) return ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
            new msg[20]; format(msg, sizeof(msg), "Message%d", pOnMsg[playerid]);
            new str[200]; format(str, sizeof(str), "{23CF00}Mesajı Düzenlemeyi Seçtiniz\n{9E9E9E}Mesaj %d: {99C98F}%s\n{FF0000}Mesajınızın En Az 6 Karakterli Olması Gerekir", pOnMsg[playerid], fstr(MSG_FILE, msg));
            if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, 113, DIALOG_STYLE_INPUT, "{2BFF00}Edit Message", str, "Değiştir", "Geri");
            fstrset(MSG_FILE, msg, inputtext);
            ReloadMessages();
            ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
            return 1;
        }
    }
    return 0;
}

CMD:mayarlar(playerid)
{
    if(!IsPlayerAdmin(playerid)) return 0;
    ShowPlayerDialog(playerid, 111, DIALOG_STYLE_TABLIST, "{1BA300}Rastgele Mesaj Ayarları", GetMessages(), "Seç", "İptal");
    return 1;
}

stock GetMessages()
{
    new string[1280], get[MAX_TEXT_SIZE], msg[20];
    format(string, sizeof(string), "{FA9E00}Ekle\t{2BFF00}Boş\n{FA9E00}Süre\t{2BFF00}%d Saniye\n{FA9E00}Tag\t{2BFF00}%s\n", Cooldown, Prefix);
    for(new i=0, j=MAX_MSG; i<j; i++)
    {
        format(msg, sizeof(msg), "Mesaj%d", i+1);
        if(!flineexist(MSG_FILE, msg)) break;
        format(get, sizeof(get), "{9E9E9E}%s\t%s\n", msg, fstr(MSG_FILE, msg));
        strcat(string, get);
    }
    return string;
}

stock ReloadMessages()
{
    new msg[20];
    for(new i, j=MAX_MSG; i<j; i++)
    {
        format(msg, sizeof(msg), "Mesaj%d", i+1);
        if(!flineexist(MSG_FILE, msg)) break;
        format(MsgIndex[i], MAX_TEXT_SIZE, "%s", fstr(MSG_FILE, msg));
    }
}

stock ReloadConfig()
{
    format(Prefix, 30, "%s",fstr(MSG_FILE, "Tag"));
    Cooldown = strval(fstr(MSG_FILE, "Süre"));
}

stock GetMessagesCount()
{
    new count, msg[20];
    for(new i, j=MAX_MSG; i<j; i++)
    {
        format(msg, sizeof(msg), "Mesaj%d", i+1);
        if(!flineexist(MSG_FILE, msg)) break;
        count++;
    }
    return count;
}

stock IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}

//Some file functions
stock fcreate(file[]) {
    if (fexist(file)) return false;
    new File:f=fopen(file,io_write);
    if (f) {
        fclose(f);
        return true;
    }
    return false;
}

stock flineexist(file[],line[]) {
    if(strlen(line)==0 || strlen(line)+2>255) return false;
    new File:f=fopen(file,io_read);
    if(!f) return false;
    new tmp[255];
    while(fread(f,tmp))
    {
        if(tmp[strlen(line)]=='=' && !strcmp(tmp, line, true, strlen(line)))
        {
            fclose(f);
            return true;
        }
    }
    fclose(f);
    return false;
}

stock fstr(file[],line[]) {
    new tmp[255];
    if(strlen(line)==0 || strlen(line)+2>255) return tmp;
    new File:f=fopen(file,io_read);
    if(!f) return tmp;
    while(fread(f,tmp))
    {
        if(tmp[strlen(line)]=='=' && !strcmp(tmp, line, true, strlen(line)))
        {
            DINI_StripNewLine(tmp);
            strmid(tmp, tmp, strlen(line) + 1, strlen(tmp), 255);
            fclose(f);
            return tmp;
        }
    }
    fclose(f);
    return tmp;
}

stock fstrset(file[],line[],value[]) {
    if(strlen(line)==0 || strlen(line)+strlen(value)+2>255) return false;
    new File:f, File:f2;
    new tmp[255];
    new bool:wasset=false;
    format(tmp,sizeof(tmp),"%s.part",file);
    fremove(tmp);
    f=fopen(file,io_read);
    if(!f) return false;
    f2=fopen(tmp,io_write);
    if(!f2)
    {
        fclose(f);
        return false;
    }
    while(fread(f,tmp))
    {
        if(!wasset && tmp[strlen(line)]=='=' && !strcmp(tmp, line, true, strlen(line)))
        {
            format(tmp,sizeof(tmp),"%s=%s",line,value);
            wasset=true;
        }
        else
        {
            DINI_StripNewLine(tmp);
        }
        fwrite(f2,tmp);
        fwrite(f2,"\r\n");
    }
    if(!wasset)
    {
        format(tmp,sizeof(tmp),"%s=%s",line,value);
        fwrite(f2,tmp);
        fwrite(f2,"\r\n");
    }
    fclose(f);
    fclose(f2);
    format(tmp,sizeof(tmp),"%s.part",file);
    if(DINI_fcopytextfile(tmp,file)) return fremove(tmp);
    return false;
}

//from dini (Dracoblue)
stock DINI_StripNewLine(string[]) {
    new len = strlen(string);
    if (string[0]==0) return ;
    if ((string[len - 1] == '\n') || (string[len - 1] == '\r')) {
        string[len - 1] = 0;
        if (string[0]==0) return ;
        if ((string[len - 2] == '\n') || (string[len - 2] == '\r')) string[len - 2] = 0;
    }
}

stock DINI_fcopytextfile(oldname[],newname[]) {
    new File:ohnd,File:nhnd;
    if (!fexist(oldname)) return false;
    ohnd=fopen(oldname,io_read);
    if (!ohnd) return false;
    nhnd=fopen(newname,io_write);
    if (!nhnd) {
        fclose(ohnd);
        return false;
    }
    new tmpres[255];
    while (fread(ohnd,tmpres)) {
        DINI_StripNewLine(tmpres);
        format(tmpres,sizeof(tmpres),"%s\r\n",tmpres);
        fwrite(nhnd,tmpres);
    }
    fclose(ohnd);
    fclose(nhnd);
    return true;
}


SS:


Reklam Olduysa Kusura Bakmayın Kaldırabilirim.


xXDieForGameXx


TRSinan28

Bende bir tane dialogsuz Oto mesaj sistemi var istersen atayım ?


xXDieForGameXx


TRSinan28

Atacaktım ama .pwn sini silmişim sistemin :D İnternette araştır illaki çalışan oluyor.


Levi

"I'm the best damn thing that your eyes have ever seen."