Its not doing nothing
#1

It's not doing nothing, in the player file, all it do is Message: 0, how I fix message ? like
Message: Hello

pawn Код:
Password: ^
Admin: 0
Jailed: 0
Wanted: 0
Bans: 0
BanTime: 0
TruckerLicense: 0
BusLicense: 0
StatsMetersDriven: 0.000000
StatsTruckerJobs: 0
StatsConvoyJobs: 0
StatsBusDriverJobs: 0
StatsPilotJobs: 0
StatsPoliceFined: 0
StatsPoliceJailed: 0
Message: 0
Money: 0
Score: 0

pawn Код:
format(LineForFile, 100, "Message: %s\r\n", APlayerData[playerid][JoinMessage]);
fwrite(PFile, LineForFile); // And save it to the file
pawn Код:
if (strcmp(ParameterName, "Message:", false) == 0) // If the parametername is correct ("JoinMessage")
                APlayerData[playerid][JoinMessage] = strval(ParameterValue); // Store the JoinMessage
This don't show when the player set their message
pawn Код:
COMMAND:setmessage(playerid, params[])
{
    new string[128], pName[MAX_PLAYER_NAME];
    if(sscanf(params, "s[128]", APlayerData[playerid][JoinMessage])) return SendClientMessage(playerid, -1, "Usage: /setmessage [message]");
    GetPlayerName(playerid, pName, sizeof(pName));
    new file[100], File:PFile, LineForFile[100];
    if (fexist(file))
    {
                    PFile = fopen(file, io_append);
                    format(LineForFile, 100, "Message: %s\r\n", APlayerData[playerid][JoinMessage]);
                    fwrite(PFile, LineForFile);
                    fclose(PFile);
                    format(string, sizeof(string), "You have set your welcome message to: %s", APlayerData[playerid][JoinMessage]);
                    SendClientMessage(playerid, -1, string);
    }
    return 1;
}
Reply
#2

Try = in files not :

Like message=text
Reply
#3

Quote:
Originally Posted by Weponz
Посмотреть сообщение
Try = in files not :

Like message=text
What?
Reply
#4

Quote:

APlayerData[playerid][JoinMessage] = strval(ParameterValue);

Strval evaluates string and returns integer. You need strcpy:
Quote:

strcat((APlayerData[playerid][JoinMessage][0] = EOS, APlayerData[playerid][JoinMessage]), ParameterValue);

Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Strval evaluates string and returns integer. You need strcpy:
pawn Код:
error 001: expected token: ")", but found "["
warning 217: loose indentation
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

Not caused by my code. Oh, and you need third argument to make it work, so pass there size of JoinMessage.
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Not caused by my code. Oh, and you need third argument to make it work, so pass there size of JoinMessage.
Still not working.
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
If you want your mode to do nothing, delete all the code that does something.
sorry.
Reply
#9

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
It's not doing nothing, in the player file, all it do is Message: 0, how I fix message ? like
Message: Hello

pawn Код:
Password: ^
Admin: 0
Jailed: 0
Wanted: 0
Bans: 0
BanTime: 0
TruckerLicense: 0
BusLicense: 0
StatsMetersDriven: 0.000000
StatsTruckerJobs: 0
StatsConvoyJobs: 0
StatsBusDriverJobs: 0
StatsPilotJobs: 0
StatsPoliceFined: 0
StatsPoliceJailed: 0
Message: 0
Money: 0
Score: 0

pawn Код:
format(LineForFile, 100, "Message: %s\r\n", APlayerData[playerid][JoinMessage]);
fwrite(PFile, LineForFile); // And save it to the file
pawn Код:
if (strcmp(ParameterName, "Message:", false) == 0) // If the parametername is correct ("JoinMessage")
                APlayerData[playerid][JoinMessage] = strval(ParameterValue); // Store the JoinMessage
This don't show when the player set their message
pawn Код:
COMMAND:setmessage(playerid, params[])
{
    new string[128], pName[MAX_PLAYER_NAME];
    if(sscanf(params, "s[128]", APlayerData[playerid][JoinMessage])) return SendClientMessage(playerid, -1, "Usage: /setmessage [message]");
    GetPlayerName(playerid, pName, sizeof(pName));
    new file[100], File:PFile, LineForFile[100];
    if (fexist(file))
    {
                    PFile = fopen(file, io_append);
                    format(LineForFile, 100, "Message: %s\r\n", APlayerData[playerid][JoinMessage]);
                    fwrite(PFile, LineForFile);
                    fclose(PFile);
                    format(string, sizeof(string), "You have set your welcome message to: %s", APlayerData[playerid][JoinMessage]);
                    SendClientMessage(playerid, -1, string);
    }
    return 1;
}
You loaded the string as an integer, which gets converted to 0.
You need this when loading:
pawn Код:
if (strcmp(ParameterName, "Message:", false) == 0) // If the parametername is correct ("JoinMessage")
                format(APlayerData[playerid][JoinMessage], 128, ParameterValue); // Store the JoinMessage
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
If you want your mode to do nothing, delete all the code that does something.
Double negative, was just about to say the same thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)