Zcmd Problem after updating
#1

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(playeridparams[])
{
    new 
str[256], str2[256], idName1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(
sscanf(params"us"idstr2))
    {
        
SendClientMessage(playerid0xFFFF00C8"Usage: /pm <id> <message>");
        return 
1;
    }
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xFFFF00C8"ERROR: Player not connected");
    if(
playerid == id) return SendClientMessage(playerid0xFFFF00C8"ERROR: You cannot pm yourself!");
    {
        
GetPlayerName(playeridName1sizeof(Name1));
        
GetPlayerName(idName2sizeof(Name2));
        
format(strsizeof(str), "PM To %s(ID %d): %s"Name2idstr2);
        
SendClientMessage(playerid0xFFFF00C8str);
        
format(strsizeof(str), "PM From %s(ID %d): %s"Name1playeridstr2);
        
SendClientMessage(id0xFFFF00C8str);
    }
    return 
1;

Reply
#2

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.
Reply
#3

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], idName1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME]; 
Reply
#4

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.
Reply
#5

This happends to all my CMDS I made.
Reply
#6

Quote:
Originally Posted by Roddan
Посмотреть сообщение
This happends to all my CMDS I made.
Those error codes must have line numbers, Please post lines.
Reply
#7

Its line 328.

PHP код:
CMD:pm(playeridparams[]) 
Reply
#8

Make sure you have #include <zcmd> at the top of the script...
or you might not have the zcmd.inc in your include folder
Reply
#9

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.
Reply
#10

Uhm, If you have this command under any callback like OnPlayerCommandText, Just remove it and add it separately.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)