Problem /me
#1

Hello, i have a problem with this Tutorial. (https://sampforum.blast.hk/showthread.php?tid=301905)
This is my error Pawno:

Код:
pdgm.pwn(698) : error 029: invalid expression, assumed zero
pdgm.pwn(698) : error 017: undefined symbol "cmd_me"
pdgm.pwn(698) : error 029: invalid expression, assumed zero
pdgm.pwn(698) : fatal error 107: too many error messages on one line
This is a string error:
Код:
COMMAND:me(playerid, params[])
Reply
#2

Do you have
pawn Код:
#include <zcmd>
?
Reply
#3

Quote:
Originally Posted by iGetty
Посмотреть сообщение
Do you have
pawn Код:
#include <zcmd>
?
Yes
Reply
#4

What are the last 5 or 10 lines above it? Because sometimes the compiler will give you errors on that line, but in fact they are in lines above it.
Reply
#5

Quote:
Originally Posted by Steven82
Посмотреть сообщение
What are the last 5 or 10 lines above it? Because sometimes the compiler will give you errors on that line, but in fact they are in lines above it.
Код:
  if(strcmp(cmdtext, "/despawned", true) == 0)
     {
          
          currentveh = GetPlayerVehicleID(playerid);
          DestroyVehicle(currentveh);
          SendClientMessage(playerid, COLOR_MESSAGGI,"[Acmd:] Hai eliminato questo veicolo");
          return 1;
     }
Reply
#6

PHP код:
CMD:meplayeridparams[ ] )
{
    new 
str[182], pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnamesizeof pname );
        if( 
sscanf(params,"u"str ) ) return SendClientMessage(playerid,0xF0F8FFAA"USAGE: {FFFFFF}/me action");
    
format(str182"%s : %s",pnameparams );
    
SendClientMessageToAll(0xF0F8FFAAstr);
    return 
1;

Reply
#7

Quote:
Originally Posted by Bogdan1992
Посмотреть сообщение
PHP код:
CMD:meplayeridparams[ ] )
{
    new 
str[182], pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnamesizeof pname );
        if( 
sscanf(params,"u"str ) ) return SendClientMessage(playerid,0xF0F8FFAA"USAGE: {FFFFFF}/me action");
    
format(str182"%s : %s",pnameparams );
    
SendClientMessageToAll(0xF0F8FFAAstr);
    return 
1;

usual error.
Reply
#8

The ZCMD commands should not be inside any callbacks. You have to use or strcmp or ZCMD. Choose on of them.
pawn Код:
// I guess this is your code
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/despawned", true) == 0)
    {
        currentveh = GetPlayerVehicleID(playerid);
        DestroyVehicle(currentveh);
        SendClientMessage(playerid, COLOR_MESSAGGI,"[Acmd:] Hai eliminato questo veicolo");
        return 1;
    }
   
    COMMAND:me(playerid, params[])
    {
        new
            string[ 128 ], Name[ MAX_PLAYER_NAME ];
           
        GetPlayerName(playerid, Name, sizeof(Name));
        if(isnull(params)) return SendClientMessage(playerid, COLOR, "Usage: /me <Text>");
        format(string, sizeof(string), "*%s %s", Name, params);
        return SendClientMessageToAll(0xFF00FFFF, string);
    }
    return 0;
}
This is wrong. The commands with ZCMD out of any Callback and don't use OnPlayerCommandText Callback.
Reply
#9

And why do u use strcmp AND zcmd together? Thats quite bad. choos one and convert the rest into the other
Reply
#10

Resolved, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)