Zcmd Problem after updating -
Roddan - 16.04.2014
Hello. When I updated my server to 0.3z RC5
I got an error on this code. I can't seem to find the problem. What causes it?
Errors:
Код:
warning 225: unreachable code
warning 217: loose indentation
error 029: invalid expression, assumed zero
error 017: undefined symbol "cmd_pm"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
PHP код:
CMD:pm(playerid, params[])
{
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, str2))
{
SendClientMessage(playerid, 0xFFFF00C8, "Usage: /pm <id> <message>");
return 1;
}
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFF00C8, "ERROR: Player not connected");
if(playerid == id) return SendClientMessage(playerid, 0xFFFF00C8, "ERROR: You cannot pm yourself!");
{
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
SendClientMessage(playerid, 0xFFFF00C8, str);
format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, 0xFFFF00C8, str);
}
return 1;
}
Re: Zcmd Problem after updating -
PrivatioBoni - 16.04.2014
Looks like you need to update ZCMD perhaps?
Also, I've noticed something with your code. For the sscanf line, it should be this:
pawn Код:
if(sscanf(params, "us[128]", id, str2))
128 can be replaced with whatever. This just means you are giving a string length. str and str2 should be put to something like 128 too.
Re: Zcmd Problem after updating -
Roddan - 16.04.2014
Quote:
Originally Posted by PrivatioBoni
Looks like you need to update ZCMD perhaps?
Also, I've noticed something with your code. For the sscanf line, it should be this:
pawn Код:
if(sscanf(params, "us[128]", id, str2))
128 can be replaced with whatever. This just means you are giving a string length. str and str2 should be put to something like 128 too.
|
Thanks for the answer but I have the latest ZCMD. But they are above.
PHP код:
new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
Re: Zcmd Problem after updating -
PrivatioBoni - 16.04.2014
That's the definition of the variables, but you need to give the destination length on the sscanf line (as explained in post #2)
If you don't do this, your server log probably says something like "Strings without a destination length are deprecated" meaning that the /pm length will be tiny in-game. I'm not saying this is what is causing the problem, but since I have no real idea on how to fix the problem your 'actual problem', I'm sure the thing I said would help anyway.
Re: Zcmd Problem after updating -
Roddan - 16.04.2014
This happends to all my CMDS I made.
Re: Zcmd Problem after updating -
Bingo - 16.04.2014
Quote:
Originally Posted by Roddan
This happends to all my CMDS I made.
|
Those error codes must have line numbers, Please post lines.
Re: Zcmd Problem after updating -
Roddan - 16.04.2014
Its line 328.
PHP код:
CMD:pm(playerid, params[])
Re: Zcmd Problem after updating -
Hybris - 16.04.2014
Make sure you have #include <zcmd> at the top of the script...
or you might not have the zcmd.inc in your include folder
Re: Zcmd Problem after updating -
Roddan - 16.04.2014
Quote:
Originally Posted by Hybris
Make sure you have #include <zcmd> at the top of the script...
or you might not have the zcmd.inc in your include folder
|
Its included and the file is there.
Re: Zcmd Problem after updating -
Bingo - 16.04.2014
Uhm, If you have this command under any callback like OnPlayerCommandText, Just remove it and add it separately.