Jump to content

teudan

Membru
  • Posts

    14
  • Joined

  • Last visited

    Never

Posts posted by teudan

  1. Am vrut sa realizez un script in care sa memorez intr-un fisier cand un player ia invite si sa stearga cand ia uninvite ca dupa sa citesc de acolo ce membrii sunt in factiune dar m-am lovit de o problema, eu am vrut ca fiecare player nou adaugat sa il scrie pe un rand nou dar nu il scrie, il scrie unul dupa altul, daca stiti de ce va rog sa ma ajutati, multumesc.

    [pawn]new tesst;

    enum cMemb

    {

    cNume[255],

    cFactiune

    };

    new MembInfo[10001][cMemb];

    public OnGameModeInit() // Do not add vehicles Above the next lines. - CuervO

    {

        LoadCate();

    LoadMembers();

    return 1;

    }

    forward LoadCate();

    public LoadCate()

    {

    new file[64];

        format(file, sizeof(file),"LARP/cate.ini")

        if(dini_Exists(file))

    {

    tesst = dini_Int(file,"cate");

    }

    printf("[sCRIPT]: Loaded Cate %d", tesst);

    return 1;

    }

    forward SaveCate();

    public SaveCate()

    {

    new string3[64];

    format(string3, sizeof(string3), "LARP/cate.ini");

    dini_IntSet(string3, "cate",tesst);

    return 1;

    }

    forward RemoveMembers(string[]);

    public RemoveMembers(string[])

    {

    tesst--;

    if(tesst <= 0)

    {

        tesst = 0;

    }

    for(new i=0;i<=tesst;i++)

    {

        if(strcmp(MembInfo[cNume], string, true) == 0)

        {

            strmid(MembInfo[cNume], MembInfo[tesst][cNume], 0, strlen(string), 255);

            strmid(MembInfo[tesst][cNume], "", 0, strlen(string), 255);

            MembInfo[cFactiune] = MembInfo[tesst][cFactiune];

            MembInfo[tesst][cFactiune] = 0;

        }

    }

    SaveCate();

    SaveMembers();

    return 1;

    }

    forward AddMembers(faction, string[]);

    public AddMembers(faction, string[])

    {

    strmid(MembInfo[tesst][cNume], string, 0, strlen(string), 255);

    MembInfo[tesst][cFactiune] = faction;

    tesst++;

    SaveCate();

    SaveMembers();

    return 1;

    }

    forward SaveMembers();

    public SaveMembers()

    {

        new idx;

    new File: file2;

    while (idx < tesst)

    {

    new coordsstring[256];

    format(coordsstring, sizeof(coordsstring), "%s|%d\n",

    MembInfo[idx][cNume],

    MembInfo[idx][cFactiune]);

    if(idx == 0)

    {

    file2 = fopen("members.cfg", io_write);

    }

    else

    {

    file2 = fopen("members.cfg", io_append);

    }

    fwrite(file2, coordsstring);

    idx++;

    fclose(file2);

    }

    }

    forward LoadMembers();

    public LoadMembers()

    {

    print("done");

    new arrCoords[20][64];

    new strFromFile2[256];

    new File: file = fopen("members.cfg", io_read);

    print("done2");

    if (file)

    {

    new idx;

    while (idx < tesst)

    {

    fread(file, strFromFile2);

    split(strFromFile2, arrCoords, '|');

    strmid(MembInfo[idx][cNume], arrCoords[0], 0, strlen(arrCoords[0]), 255);

    MembInfo[idx][cFactiune] = strval(arrCoords[1]);

    printf("%s si fac %d",MembInfo[idx][cNume], MembInfo[idx][cFactiune]);

    idx++;

    }

    fclose(file);

    }

    }

    // asta pui la invite: AddMembers(PlayerInfo[playerid][pLeader], giveplayer);

    //asta pui la uninvite: RemoveMembers(giveplayer);[/pawn]

  2. Am vrut sa realizez un script in care sa memorez intr-un fisier cand un player ia invite si sa stearga cand ia uninvite ca dupa sa citesc de acolo ce membrii sunt in factiune dar m-am lovit de o problema, eu am vrut ca fiecare player nou adaugat sa il adauge pe un rand nou dar nu il adauga, il adauga unul dupa altul, daca stiti de ce va rog sa ma ajutati, multumesc.

    [pawn]new tesst;

    enum cMemb

    {

    cNume[255],

    cFactiune

    };

    new MembInfo[10001][cMemb];

    public OnGameModeInit()

    {

        LoadCate();

    LoadMembers();

    return 1;

    }

    forward LoadCate();

    public LoadCate()

    {

    new file[64];

        format(file, sizeof(file),"LARP/cate.ini")

        if(dini_Exists(file))

    {

    tesst = dini_Int(file,"cate");

    }

    printf("[sCRIPT]: Loaded Cate %d", tesst);

    return 1;

    }

    forward SaveCate();

    public SaveCate()

    {

    new string3[64];

    format(string3, sizeof(string3), "LARP/cate.ini");

    dini_IntSet(string3, "cate",tesst);

    return 1;

    }

    forward RemoveMembers(string[]);

    public RemoveMembers(string[])

    {

    tesst--;

    if(tesst <= 0)

    {

        tesst = 0;

    }

    for(new i=0;i<=tesst;i++)

    {

        if(strcmp(MembInfo[cNume], string, true) == 0)

        {

            strmid(MembInfo[cNume], MembInfo[tesst][cNume], 0, strlen(string), 255);

            strmid(MembInfo[tesst][cNume], "", 0, strlen(string), 255);

            MembInfo[cFactiune] = MembInfo[tesst][cFactiune];

            MembInfo[tesst][cFactiune] = 0;

        }

    }

    SaveCate();

    SaveMembers();

    return 1;

    }

    forward AddMembers(faction, string[]);

    public AddMembers(faction, string[])

    {

    strmid(MembInfo[tesst][cNume], string, 0, strlen(string), 255);

    MembInfo[tesst][cFactiune] = faction;

    tesst++;

    SaveCate();

    SaveMembers();

    return 1;

    }

    forward SaveMembers();

    public SaveMembers()

    {

        new idx;

    new File: file2;

    while (idx < tesst)

    {

    new coordsstring[256];

    format(coordsstring, sizeof(coordsstring), "%s|%d\n",

    MembInfo[idx][cNume],

    MembInfo[idx][cFactiune]);

    if(idx == 0)

    {

    file2 = fopen("members.cfg", io_write);

    }

    else

    {

    file2 = fopen("members.cfg", io_append);

    }

    fwrite(file2, coordsstring);

    idx++;

    fclose(file2);

    }

    }

    forward LoadMembers();

    public LoadMembers()

    {

    print("done");

    new arrCoords[20][64];

    new strFromFile2[256];

    new File: file = fopen("members.cfg", io_read);

    print("done2");

    if (file)

    {

    new idx;

    while (idx < tesst)

    {

    fread(file, strFromFile2);

    split(strFromFile2, arrCoords, '|');

    strmid(MembInfo[idx][cNume], arrCoords[0], 0, strlen(arrCoords[0]), 255);

    MembInfo[idx][cFactiune] = strval(arrCoords[1]);

    printf("%s si fac %d",MembInfo[idx][cNume], MembInfo[idx][cFactiune]);

    idx++;

    }

    fclose(file);

    }

    }

    // asta pui la invite: AddMembers(PlayerInfo[playerid][pLeader], giveplayer);

    //asta pui la uninvite: RemoveMembers(giveplayer);[/pawn]

  3. Am incercat sa fac o comanda cu care liderul sa poata vedea toti membrii factiuni lui si nu mi-a iesit, imi puteti spune de ce?

    [pawn]

    if(strcmp(cmd, "/allmember", true) == 0)

    {

            if(PlayerInfo[playerid][pLeader] == 0) { return SendClientMessage(playerid, COLOR_LIGHTRED, "Tu nu esti lider !");}

            new string2[64];

            for(new i = 0; i < MAX_PLAYER_NAME; i++)

    {

          format(string2, sizeof(string2), "LARP/Users/%s.ini", i);

    if(PlayerInfo[playerid][pLeader] == dini_Int(string2,"Member"))

    {

          format(string, 256, "Membrul: %d",string2);

          SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

    }

    }

    return 1;

    }

    [/pawn]

  4. Dezarhiveaza asta si copiaza peste folderul serverului tau. Nu copiat si server.cfg. Inainte iti propun sa iti faci o copie la server, in caz ca nu o sa fi multumit sa te poti schimba inapoi.

    team.sa-mp.com/files/samp03dsvr_R2_win32.zip

    dupa care uploadeaza-ti streamu sa nu ai aceleasi probleme pe care le-am avut eu.

    http://code.google.com/p/samp-streamer-plugin/downloads/detail?name=streamer_plugin_v2_6_r26.rar&can=2&q=

  5. Am creat un script pentru radio online si nu merge decat decat un tip de radio adica acel radio care are extensia .mp3, extensia .pls care este cea mai folosita la radio nu merge, sau extensia .m3u. Daca stie cineva de ce sau cum se rezolva sa posteze, multumesc.

    [pawn]

    #define DIALOG_RADIO_CATEGORIES 6345 // Radio categories

    #define DIALOG_RADIO_STATIONS 6346 // Radio stations

    #define MAX_ST_TYPE 31

    #define MAX_ST_NAME 30

    #define MAX_ST_URL 130

    enum e_Audio_Stations

    {

    st_name[MAX_ST_NAME],

    st_type[MAX_ST_TYPE],

    st_url[MAX_ST_URL]

    };

    new Audio_Stations[][e_Audio_Stations] =

    {

    // STATION NAME // CATEGORY // URL

    { "Turn radio off", "{AA3333}Turn radio off{FFFFFF}", "Turn radio off" }, // Leave this one in to allow disabling the radio

    { "ProFm", "ProFm", "http://stream.profm.ro:8012/profm.mp3" }, //.mp3 merge

    { "RadioZu", "RadioZu", "www.radiozu.ro/live.m3u" }, // .m3u nu merge

    { "VideFM", "VideFM", "http://89.238.252.146:9000/listen.pls" } // .pls nu merge

    };

    public OnPlayerCommandText(playerid, cmdtext[])

    {

        if(strcmp(cmd, "/radio", true) == 0)

    {

        if(IsPlayerInAnyVehicle(playerid))

        {

    new szRadioCategories[500];

    for(new i; i < sizeof(Audio_Stations); i++)

    {

    if(strfind(szRadioCategories, Audio_Stations[st_type], true) != -1)

    continue;

    format(szRadioCategories, sizeof(szRadioCategories), "%s%s\n", szRadioCategories, Audio_Stations[st_type]);

    }

    ShowPlayerDialog(playerid, DIALOG_RADIO_CATEGORIES, DIALOG_STYLE_LIST, "Radio categories", szRadioCategories, "Select", "Close");

    }

    else

    {

    SendClientMessage(playerid,COLOR_GREY,"You should be in a car to start radio");

    }

    return 1;

    }

    return 0;

    }

    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

    {

    if(dialogid == DIALOG_RADIO_CATEGORIES)

    {

    if(!response)

    return 0;

    if(!strcmp(inputtext, "Turn radio off"))

    {

    StopAudioStreamForPlayer(playerid);

    SendClientMessage(playerid, COLOR_GREEN, "Radio turned off.");

    return 1;

    }

    new

    szRadioStations[250];

    for(new i; i < sizeof(Audio_Stations); i++)

    {

    if(strfind(inputtext, Audio_Stations[st_type], true) == -1)

    continue;

    format(szRadioStations, sizeof(szRadioStations), "%s%s\n", szRadioStations, Audio_Stations[st_name]);

    }

    ShowPlayerDialog(playerid, DIALOG_RADIO_STATIONS, DIALOG_STYLE_LIST, "Radio stations", szRadioStations, "Tune in", "Close");

    return 1;

    }

    if(dialogid == DIALOG_RADIO_STATIONS)

    {

    if(!response)

    return 0;

    for(new i; i < sizeof(Audio_Stations); i++)

    {

    if(strfind(inputtext, Audio_Stations[st_name], true) == -1)

    continue;

    StopAudioStreamForPlayer(playerid);

    PlayAudioStreamForPlayer(playerid, Audio_Stations[st_url]);

    new

    szString[22 + MAX_ST_NAME];

    format(szString, sizeof(szString), "Tuned in to station: %s", Audio_Stations[st_name]);

    SendClientMessage(playerid, COLOR_GREEN, szString);

    return 1;

    }

    }

    return 1;

    }[/pawn]

  6. Buna seara, am incercat sa creez o comanda cu care sa modific numele, am creat'o a modific numele a creat un nou fisier dar  nu l-a sters pe vechiul, de ce?

    [pawn]

    if(strcmp(cmd, "/changename", true) == 0)

    {

    new tmpp[256];

    tmpp = strtok(cmdtext, idx);

    if(!strlen(tmpp))

    {

    SendClientMessage(playerid, COLOR_DBLUE, "Correct SYNTAX: /changename [playerid] [new nick]");

    return 1;

    }

      giveplayerid = strval(tmpp);

    tmp = strtok(cmdtext, idx);

    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

    GetPlayerName(playerid, sendername, sizeof(sendername));

    if(IsPlayerConnected(playerid))

    {

        if(PlayerInfo[playerid][pAdmin] >= 1337)

        {

            if(IsPlayerConnected(giveplayerid))

            {

        if(!dini_Exists(string))

    {

        SetPlayerName(giveplayerid, tmp);

    format(string, sizeof(string),"** Your name was changne to %s by %s", tmp, playerid);

    SendClientMessage(giveplayerid, COLOR_SEA, string);

    format(string, sizeof(string),"** Succeful change %s's name", giveplayerid);

    SendClientMessage(playerid, COLOR_SEA, string);

    new housekey = PlayerInfo[giveplayerid][pPhousekey];

    new bizzkey = PlayerInfo[giveplayerid][pPbiskey];

    new carkey1 = PlayerInfo[giveplayerid][pPcarkey];

    new carkey2 = PlayerInfo[giveplayerid][pPcarkey2];

    format(string, sizeof(string),"%s",tmp);

    if(PlayerInfo[giveplayerid][pPhousekey] != 9999)

    {

        strmid(HouseInfo[housekey][hOwner],string,0,strlen(string),255);

        ProportionalUpdate(1,housekey);

        OnPropTextdrawUpdate(1, housekey);

        SendClientMessage(giveplayerid, TEAM_GROVE_COLOR,"* House ownership changed successfuly!");

    }

    if(PlayerInfo[giveplayerid][pPbiskey] != 9999)

    {

        strmid(BizzInfo[bizzkey][bOwner],string,0,strlen(string),255);

        ProportionalUpdate(2,bizzkey);

        OnPropTextdrawUpdate(2, bizzkey);

        SendClientMessage(giveplayerid, TEAM_GROVE_COLOR,"* Business ownership changed successfuly!");

    }

    if(PlayerInfo[giveplayerid][pPcarkey] != 9999)

    {

        strmid(CarInfo[carkey1][cOwner],string,0,strlen(string),255);

        ProportionalUpdate(4,carkey1);

        SendClientMessage(giveplayerid, TEAM_GROVE_COLOR,"* First Vehicle ownership changed successfuly!");

    }

    if(PlayerInfo[giveplayerid][pPcarkey2] != 9999)

    {

        strmid(CarInfo[carkey2][cOwner],string,0,strlen(string),255);

        ProportionalUpdate(4,carkey2);

        OnPropTextdrawUpdate(1, housekey);

        SendClientMessage(giveplayerid, TEAM_GROVE_COLOR,"* Second Vehicle ownership changed successfuly!");

    }

          format(string, sizeof(string), "LARP/Users/%s.ini", giveplayerid);

    fremove(string);

    format(string, sizeof(string), "LARP/Users/%s.ini", tmp);

    dini_Create(string);

    OnPlayerUpdateEx(giveplayerid);

    ChangedName[playerid] = 1;

    }

    }

    else

    {

        format(string, sizeof(string), "%d is not an active player.", giveplayerid);

    SendClientMessage(playerid, COLOR_RED, string);

    }

    }

    else

    {

        SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");

    }

    }

    else

    {

        SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");

    }

      return 1;

    }

    [/pawn]

  7. Problema mea consta in un bug la deschiderea/inchiderea usilor de cand am instalat versiunea 0.3d. Daca cineva stie cum sa rezolv bugul sa posteze aici. Multumesc

    http://postimage.org/image/pshj144fd/ - usa cand intru in PD

    http://postimage.org/image/ncfpn9mcp/ - cum arata usa dupa ce o deschid

    http://postimage.org/image/llwols4tl/ - cum arata usa dupa ce o inchid

    Bugul este la toate usile( http://s11.postimage.org/unu21qd7n/sa_mp_006.png)

    Scriptul pentru prima usa


    new lspddoor2;
    new lspd2;
    public OnGameModeInit()
    {
          lspd2 = 0;
          lspddoor2 = CreateDynamicObject(5422, 246.228,72.4962,1003.04,0.00,0.00,90.00);
          return 1;
    }
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if ( PRESSED(KEY_LOOK_BEHIND) )
    {
    if(IsAPDMember(playerid) || PlayerInfo[playerid][pAdmin] >= 6)
    {
      if(IsPlayerInRangeOfPoint(playerid, 2,246.228,72.4962,1003.04))
    {
    if(lspd2 == 0)
        {
          MoveDynamicObject(lspddoor2, 246.228,72.4962,1000.63, 4.5);
          SendClientMessage(playerid, COLOR_BLUE,"SAPD door is open, please close it!");
          GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "* %s takes his/her remote control and opens the door.", sendername);
          ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3, COLOR_CHAT4,COLOR_CHAT5);
          lspd2 = 1;
    }
        else
    {
    MoveDynamicObject(lspddoor2, 246.228,72.4962,1003.18, 4.5);
          SendClientMessage(playerid, COLOR_BLUE,"SAPD Control door is closed, thank you!");
          GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "* %s takes his/her remote control and Closes the door.",sendername);
          ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
          lspd2 = 0;
    }
    }
    }
    }
        return 1;

    }             

    Tin sa precizez ca inainte de 0.3d se deschidea bine usa.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.