Message not showing, how i make it show? -
DerickClark - 26.01.2014
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;
}
Re: Its not doing nothing -
Weponz - 26.01.2014
Try = in files not :
Like message=text
Re: Its not doing nothing -
DerickClark - 26.01.2014
Quote:
Originally Posted by Weponz
Try = in files not :
Like message=text
|
What?
Re: Its not doing nothing -
Misiur - 26.01.2014
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);
|
Re: Its not doing nothing -
DerickClark - 26.01.2014
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.
Re: Its not doing nothing -
Misiur - 26.01.2014
Not caused by my code. Oh, and you need third argument to make it work, so pass there size of JoinMessage.
Re: Its not doing nothing -
DerickClark - 26.01.2014
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.
Re: Its not doing nothing -
DerickClark - 26.01.2014
Quote:
Originally Posted by ******
If you want your mode to do nothing, delete all the code that does something.
|
sorry.
Re: Its not doing nothing -
PowerPC603 - 26.01.2014
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
Re: Its not doing nothing -
Shetch - 26.01.2014
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.