SA-MP Forums Archive
Nametag Save/Load? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Nametag Save/Load? (/showthread.php?tid=550246)



Nametag Save/Load? - Slicebook - 11.12.2014

Hello people!
such is how I can do that, two player wants to be friends, type command pl. /friend ID and from then on they see each other's names.(ShowNameTagPlayer) and save dini.
something like this:
John_Bellic friends:
Tom_Wick
Johnny_Depp
Gordon_Big

Tom_Wick friends:
John_Bellic

And player connect load friends.

I tried to somehow solve,but it did not work. The save failed, shownametag succeeded only.
If you can help with this please comment!


(Bad english sorry)


Re: Nametag Save/Load? - UltraScripter - 11.12.2014

join for a sec
85.65.212.50:9999
i did that script but i want to test if it work so i need you! .


Re: Nametag Save/Load? - UltraScripter - 11.12.2014

hmm nevermind try this:
pawn Код:
#include <a_samp>
#include <dini>
#include <sscanf2>
#include <zcmd>

new Name[MAX_PLAYER_NAME];
new Name2[MAX_PLAYER_NAME];
new File[256];
new pid;
new Str[128];
new FStr[128];

#define FRIEND "Friends/%s.ini"

#if defined FILTERSCRIPT

#endif

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    GetPlayerName(playerid, Name, sizeof(Name));
    GetPlayerName(pid, Name2, sizeof(Name2));
    format(File, sizeof(File), FRIEND, Name);
    if(dialogid == 1555)
    {
       if(!response) return SendClientMessage(playerid, 0xFF0000FF, "FriendShip Denied!");
       if(response)
       {
          SendClientMessage(playerid, 0x00FF00FF, "FriendShipe Accepted Congrats!!!");
          format(FStr, sizeof(FStr), " %s,", Name2);
          dini_Create(File);
          dini_Set(File, "Friends", FStr);
          dini_Set(File, "\n", FStr);
       }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

CMD:addfriend(playerid, params[])
{
    GetPlayerName(playerid, Name, sizeof(Name));
    GetPlayerName(pid, Name2, sizeof(Name2));
    format(File, sizeof(File), FRIEND, Name);
    if(sscanf(params, "us", pid)) return SendClientMessage(playerid, 0xFF0000FF, "Usage : /AddFriend [ID]!");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFF0000FF, "Player Is Not Connected!");
    format(Str, sizeof(Str), "%s Want To Add You As A Friend!", Name);
    ShowPlayerDialog(pid, 1555, DIALOG_STYLE_MSGBOX, "Friend Req!!!", Str, "Accept", "Cancel");
    return 1;
}

CMD:myfriend(playerid, params[])
{
    new fl[128];
    GetPlayerName(playerid, Name, sizeof(Name));
    GetPlayerName(pid, Name2, sizeof(Name2));
    format(File, sizeof(File), FRIEND, Name);
    new friends;
    new friends2;
    friends = dini_Int(File, "Friends");
    friends2 = dini_Int(File, "\n");
    format(fl, sizeof(fl), "{00FF00}Friend : {FFFF00}%s, %s", friends, friends2);
    SendClientMessage(playerid, 0xFFFF00FF, Str);
    return 1;
}

#pragma unused ret_memcpy



Re: Nametag Save/Load? - Slicebook - 11.12.2014

okey ! thanks