SA-MP Forums Archive
Problem /me - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem /me (/showthread.php?tid=311012)



Problem /me - Davman - 14.01.2012

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[])



Re: Problem /me - iGetty - 14.01.2012

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


Re: Problem /me - Davman - 14.01.2012

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



Re: Problem /me - Steven82 - 14.01.2012

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.


Re: Problem /me - Davman - 14.01.2012

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;
     }



Re: Problem /me - Bogdan1992 - 14.01.2012

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;




Re: Problem /me - Davman - 14.01.2012

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.


Re: Problem /me - Konstantinos - 14.01.2012

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.


Re: Problem /me - milanosie - 14.01.2012

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


Re: Problem /me - Davman - 14.01.2012

Resolved, thanks