convert dini to y_Ini
#1

There anywhere I can add it as Y_Ini.
savin as Y_Ini

PlayerInfo[playerid][JoinMessage]

pawn Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], file[128], pName[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", params[0]);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "accounts/%s.ini", pName);
    dini_Create(file);
    dini_Set(file, "personalmsg", params[0]);
    return 1;
}
Reply
#2

Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], file[128], pName[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", params[0]);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "accounts/%s.ini", pName);
    new INI:File = INI_Open(file);
    INI_SetString(file, "personalmsg", PlayerInfo[playerid][JoinMessage]);
    INI_Close(file);
    return 1;
}
btw read this tutorial:
https://sampforum.blast.hk/showthread.php?tid=175565
Reply
#3

Quote:
Originally Posted by Lidor124
Посмотреть сообщение
Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], file[128], pName[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", params[0]);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "accounts/%s.ini", pName);
    new INI:File = INI_Open(file);
    INI_SetString(file, "personalmsg", PlayerInfo[playerid][JoinMessage]);
    INI_Close(file);
    return 1;
}
btw read this tutorial:
https://sampforum.blast.hk/showthread.php?tid=175565
pawn Код:
(2072) : error 017: undefined symbol "INI_SetString"
(2073) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], file[128], pName[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", PlayerInfo[playerid][JoinMessage]);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "accounts/%s.ini", pName);
    INI_SetString(file, "personalmsg", PlayerInfo[playerid][JoinMessage]);
    INI_Close(file);
    return 1;
}
Reply
#4

My bad, change SetString to WriteString.
Reply
#5

pawn Код:
(2072) : error 035: argument type mismatch (argument 1)
(2073) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], file[128], pName[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", PlayerInfo[playerid][JoinMessage]);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "accounts/%s.ini", pName);
    INI_WriteString(file, "personalmsg", PlayerInfo[playerid][JoinMessage]);
    INI_Close(file);
    return 1;
}
Error Line:
1:
pawn Код:
INI_WriteString(file, "personalmsg", PlayerInfo[playerid][JoinMessage]);
2:
pawn Код:
INI_Close(file);
Reply
#6

Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], INI:file[128], pName[MAX_PLAYER_NAME];
    if(isnull(params)) return SendClientMessage(playerid, COLOUR_RED, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", PlayerInfo[playerid][JoinMessage]);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "accounts/%s.ini", pName);
    INI_Open(file);
    INI_WriteString(file, "personalmsg", PlayerInfo[playerid][JoinMessage]);
    INI_Close(file);
    return 1;
}
INI_WriteString needs to have the length of the string on the end. Like if it's 32 characters it's
Код:
INI_WriteString(file, "personalmsg", PlayerInfo[playerid][JoinMessage], 32);
Reply
#7

Still 2 errors
pawn Код:
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

@Bool, I have tried your code.

pawn Код:
(2071) : warning 213: tag mismatch
(2072) : warning 213: tag mismatch
(2073) : error 035: argument type mismatch (argument 1)
(2074) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#8

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Still 2 errors
pawn Код:
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

@Bool, I have tried your code.

pawn Код:
(2071) : warning 213: tag mismatch
(2072) : warning 213: tag mismatch
(2073) : error 035: argument type mismatch (argument 1)
(2074) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Yeah uhh, I didn't actually fix it for you. I told you what I thought was wrong.

This compiles for me.
Код:
COMMAND:joinmessage(playerid, params[])
{
    new string[128], pName[MAX_PLAYER_NAME], locfile[32];
    if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: {FFFFFF}/joinmessage [message]");
    format(string, sizeof(string), "You have set your Join Message to: %s", params);
    SendClientMessage(playerid, -1, string);
    GetPlayerName(playerid, pName, sizeof(pName));
    format(locfile, sizeof(locfile), "accounts/%s.ini", pName);
    new INI:file = INI_Open(locfile);
    INI_WriteString(file, "personalmsg", params);
    INI_Close(file);
    return 1;
}
Take note though, I'm not actually saving the JoinMessage, but I am writing it to INI file, so when the player connects(Because it's a join message, right) Load it from the INI File then and assign it to PlayerInfo[playerid][JoinMessage];
Reply
#9

On player registerin
Creates the Message, like you have Test, if you wanna to edit it, you can use /joinmessage
format(File, sizeof(File), "accounts/%s.ini", ReturnName(playerid));
INI_WriteString(File, "JoinMessage", "50");
INI_Close(File);

error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#10

I said LOAD it. Wherever you load your stuff, load your JoinMessage there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)