Help CMD "/id"
#1

How to fix it.
Код:
  if (strcmp("/id", cmdtext, true, 10) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /id [playerid/PartOfName]");
				return 1;
			}
			new target;
			target = ReturnUser(tmp);
			new sstring[128];
			if(IsPlayerConnected(target))
			{
			    if(target != INVALID_PLAYER_ID)
			    {
					GetPlayerName(target, giveplayer, sizeof(giveplayer));
					format(sstring, sizeof(sstring), "ID: (%d) %s",target,giveplayer);
					SendClientMessage(playerid, COLOR_GRAD1, sstring);
				}
			}
		}
		return 1;
	}
Код:
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(772) : error 017: undefined symbol "tmp"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(772) : error 017: undefined symbol "strtok"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(773) : error 017: undefined symbol "tmp"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(775) : error 017: undefined symbol "COLOR_GRAD2"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(779) : error 017: undefined symbol "ReturnUser"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(785) : error 017: undefined symbol "giveplayer"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(785) : error 017: undefined symbol "giveplayer"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(785) : error 029: invalid expression, assumed zero
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(785) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.
Reply
#2

paste this any where:

Код:
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
 
	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
PHP код:
        if (strcmp("/id"cmdtexttrue10) == 0)
    {
         new 
tmp[128], giveplayer[MAX_PLAYER_NAME], idx;
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playerid, -1"USAGE: /id [playerid/PartOfName]");
                return 
1;
            }
            new 
target strval(tmp);
            new 
sstring[128];
            if(
IsPlayerConnected(target))
            {
                if(
target != INVALID_PLAYER_ID)
                {
                    
GetPlayerName(targetgiveplayersizeof(giveplayer));
                    
format(sstringsizeof(sstring), "ID: (%d) %s",target,giveplayer);
                    
SendClientMessage(playerid, -1sstring);
                }
            }
        }
        return 
1;
    } 
Reply
#3

How to fix that?
Код:
    public OnPlayerCommandPerformed(playerid, cmdtext[], success)
	{
	if(!success) SendClientMessage(playerid, -1, "That command does not exist. Use /help or /commands..");
    return 1;
	}
Код:
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(739) : error 029: invalid expression, assumed zero
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(739) : error 004: function "OnPlayerCommandPerformed" is not implemented
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(741) : error 017: undefined symbol "success"
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(744) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#4

Quote:
Originally Posted by Bug.
Посмотреть сообщение
How to fix that?
Код:
    public OnPlayerCommandPerformed(playerid, cmdtext[], success)	{
	if(!success) 
   {
        SendClientMessage(playerid, -1, "That command does not exist. Use /help or /commands..");
        return 1;
        }
    }
like that
Reply
#5

Код:
:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(739) : error 029: invalid expression, assumed zero
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(739) : error 004: function "OnPlayerCommandPerformed" is not implemented
H:\CokeTDM [0.3e]\gamemodes\NpTDM.pwn(741) : error 017: undefined symbol "success"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
How to Fix it?
Reply
#6

#include <zcmd>
Reply
#7

If you use zcmd, you don't use OnPlayerCommandText ...
Reply
#8

Use code like this

Quote:

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new string[70];
format(string, sizeof(string), "Error: {FFFFFF}The command '%s' was not recognised, please type /help.", cmdtext);
SendClientMessage(playerid, -1, string);
}
return 1;
}

To the guy above, what is that, useless comment
Reply
#9

Quote:
Originally Posted by CrazyChoco
Посмотреть сообщение
Use code like this



To the guy above, what is that, useless comment
Код:
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(81) : error 029: invalid expression, assumed zero
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(81) : error 017: undefined symbol "OnPlayerCommandPerformed"
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(82) : warning 217: loose indentation
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(83) : error 017: undefined symbol "success"
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(91) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
How to Fix it, i need put ZCMD?, If yes can you give me Download link?
Reply
#10

Quote:
Originally Posted by Bug.
Посмотреть сообщение
Код:
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(81) : error 029: invalid expression, assumed zero
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(81) : error 017: undefined symbol "OnPlayerCommandPerformed"
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(82) : warning 217: loose indentation
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(83) : error 017: undefined symbol "success"
H:\CokeTDM [0.3e]\filterscripts\CMD.pwn(91) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
How to Fix it, i need put ZCMD?, If yes can you give me Download link?
using zcmd will affect OnPlayerCommandText (your strcmp(commands) won't work like that)

any way, for more information about zcmd and download link is here
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)