Error format.. -
[RO]Five - 26.12.2013
(204) : error 001: expected token: "]", but found "-identifier-"
(204) : warning 215: expression has no effect
(204) : error 001: expected token: ";", but found "]"
(204) : error 029: invalid expression, assumed zero
(204) : fatal error 107: too many error messages on one line
Код:
#include <trasee>
// ...
enum _MISIUNE
{
mMarfa[50],
mLoadp[70],
mUnloadp[70],
Float:mLoadp_x,
Float:mLoadp_y,
Float:mLoadp_z,
Float:mUnLoadp_x,
Float:mUnLoadp_y,
Float:mUnLoadp_z
}
// ...
if(strcmp(cmd, "/start", true) == 0) //start
{
new transport_marfa = random(sizeof(LS_CARGO_MARFA));
new transport_nume_loadp = random(sizeof(LS_CARGO_LoadPoint_Nume));
new transport_nume_unloadp = random(sizeof(LS_CARGO_UnLoadPoint_Nume));
format(MisiuneInfo[playerid][mLoadp], sizeof(MisiuneInfo[playerid][mLoadp]), "%s", LS_CARGO_LoadPoint_Nume[transport_nume_loadp]); // Line 204
format(MisiuneInfo[playerid][mLoadp], sizeof(MisiuneInfo[playerid][mLoadp]), "%s", LS_CARGO_LoadPoint_Nume[transport_nume_loadp]); // Line 205
format(MisiuneInfo[playerid][mUnoadp], sizeof(MisiuneInfo[playerid][mUnoadp]), "%s", LS_CARGO_UnLoadPoint_Nume[transport_nume_unloadp]); // Line 206
}
// ...
trasee.inc
Код:
new LS_CARGO_LoadPoint_Nume[][] = {
{"LS: Cargo Trailer"},
{"LS: Jefferson Motel"},
{"LS: Sprunk INC."},
{"LS: Stadium"},
{"LS: Docks"},
{"LS: Motel"},
{"LS: Construction Site"},
{"LS: Farmacie"},
{"LS: Cathay"},
{"LS: Grotii"}
};
new LS_CARGO_UnLoadPoint_Nume[][] = {
{"LS: Haul"},
{"LS: Fallen"},
{"SF: Airport"},
{"SF: Stadium"},
{"SF: Computer Teh"},
{"SF: Cluchin Bell"},
{"SF: Hispital"},
{"SF: SupaSave"},
{"SF: GunDealer"},
{"SF: WangCars"},
{"LV: 4 Dragons"},
{"LV: Piramida"},
{"LV: Auto Bahn"},
{"LV: Royal Casino"},
{"LV: Corabie"},
{"LV: Clowns Pocket"},
{"LV: Rock Hotel"},
{"LV: Mall"},
{"LV: Stadion Bandits"}
Re: Error format.. -
Konstantinos - 26.12.2013
pawn Код:
sizeof(MisiuneInfo[playerid][mLoadp])
sizeof(MisiuneInfo[playerid][mLoadp])
sizeof(MisiuneInfo[playerid][mUnoadp])
You cannot use
sizeof in this case. Use their values instead.
pawn Код:
format(MisiuneInfo[playerid][mLoadp], 70, "%s", LS_CARGO_LoadPoint_Nume[transport_nume_loadp]);
format(MisiuneInfo[playerid][mLoadp], 70, "%s", LS_CARGO_LoadPoint_Nume[transport_nume_loadp]);
format(MisiuneInfo[playerid][mUnoadp], 70, "%s", LS_CARGO_UnLoadPoint_Nume[transport_nume_unloadp]);
But format is slow and it's not the best way of copying strings. Use strcat instead. A useful macro:
pawn Код:
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
And it can be used as:
pawn Код:
strcpy(MisiuneInfo[playerid][mLoadp], LS_CARGO_LoadPoint_Nume[transport_nume_loadp], 70);
strcpy(MisiuneInfo[playerid][mLoadp], LS_CARGO_LoadPoint_Nume[transport_nume_loadp], 70);
strcpy(MisiuneInfo[playerid][mUnoadp], LS_CARGO_UnLoadPoint_Nume[transport_nume_unloadp], 70);
Re: Error format.. -
[RO]Five - 26.12.2013
thx.. this work..
But..
Код:
if(strcmp(cmd, "/cursa", true) == 0) //cursa
{
if(IsPlayerConnected(playerid))
{
if(cursa[playerid] == 1)
{
new Str[400];
format(Str, sizeof(Str), "\n{FFFFFF}** {50AC40}Transporti: {815FDC}%s\n\n{FFFFFF}** {50AC40}Incarci marfa la {815FDC}%d\n\n{FFFFFF}** {50AC40}Descarci marfa la {815FDC}%d\n\n",
MisiuneInfo[playerid][mMarfa], MisiuneInfo[playerid][mLoadp], MisiuneInfo[playerid][mUnloadp]);
ShowPlayerDialog(playerid, CURSA, DIALOG_STYLE_MSGBOX, "{FFFFFF}Informatii cursa", Str, "Ok", "");
format(string, sizeof(string), "{FFFFFF}[{DD0000}CMD{FFFFFF}] {50AC40}%s {B1BBBE}a folosit {FFFFFF}'{815FDC}/cursa{FFFFFF}'.", sendername);
SAM(c_alb, string);
}
else SCM(playerid, c_alb, "{FFFFFF}[{815FDC}System{FFFFFF}] {50AC40}Nu ai inceput vreo cursa{FFFFFF}.");
}
}
http://imgur.com/Av4pThm
Re: Error format.. -
Konstantinos - 26.12.2013
The "SERVER: Unknown command." message?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
// other commands..
if(!strcmp(cmdtext, "/cursa", true))
{
if(cursa[playerid] == 1)
{
new Str[400];
format(Str, sizeof(Str), "\n{FFFFFF}** {50AC40}Transporti: {815FDC}%s\n\n{FFFFFF}** {50AC40}Incarci marfa la {815FDC}%d\n\n{FFFFFF}** {50AC40}Descarci marfa la {815FDC}%d\n\n",
MisiuneInfo[playerid][mMarfa], MisiuneInfo[playerid][mLoadp], MisiuneInfo[playerid][mUnloadp]);
ShowPlayerDialog(playerid, CURSA, DIALOG_STYLE_MSGBOX, "{FFFFFF}Informatii cursa", Str, "Ok", "");
format(string, sizeof(string), "{FFFFFF}[{DD0000}CMD{FFFFFF}] {50AC40}%s {B1BBBE}a folosit {FFFFFF}'{815FDC}/cursa{FFFFFF}'.", sendername);
SAM(c_alb, string);
}
else SCM(playerid, c_alb, "{FFFFFF}[{815FDC}System{FFFFFF}] {50AC40}Nu ai inceput vreo cursa{FFFFFF}.");
return 1;
}
// other commands..
return 0;
}
strcmp is slow though, ZCMD or y_commands is recommended.
Re: Error format.. -
[RO]Five - 26.12.2013
It should look like this.
http://imgur.com/cYD3PIS
"Transporti
MisiuneInfo[playerid][mMarfa]"
"Incarci marfa la
MisiuneInfo[playerid][mLoadp]"
"Descarci marfa la
MisiuneInfo[playerid][mUnloadp]"