Need help with idx
#1

I need some help understanding the following errors with my Command

Код:
error 017: undefined symbol "length"
error 029: invalid expression, assumed zero
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Код:
CMD:reportbug(playerid, params[])
{
	if(IsPlayerConnected(playerid))
 	{
  		if(PlayerInfo[playerid][pBugMuted] == 1)
    	{
     		return SendClientMessage(playerid, COLOR_GREY, "   You are banned from using /reportbug ! ");
       	}
        if(JustBugReported[playerid] == 1)
        {
        	SendClientMessage(playerid, COLOR_GREY, "   Wait 20 seconds after sending a next bug report ! ");
         	return 1;
       	}
        strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
		//new length = strlen;
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[128];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /reportbug [text]");
			return 1;
		}
		JustBugReported[playerid] = 1;
		SetTimerEx("BugReportReset", 20000, false, "i", playerid);
		format(string, sizeof(string), "Bug Report From [%d]%s: %s",playerid, sendername, (result));
  		SendTesterMessage(SCOLOR_GREEN, string);
		SendClientMessage(playerid, COLOR_YELLOW, "Your bug report message was sent to the online testers, thank you.");
  	}
   	return 1;
}
Giving +REP for quick replies and help
Reply
#2

Just use sscanf.
Reply
#3

Do NOT use strtok for that. Use sscanf for parameters, though in your case is not needed.

pawn Код:
CMD:reportbug(playerid, params[])
{
    if(PlayerInfo[playerid][pBugMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "   You are banned from using /reportbug ! ");
    if(JustBugReported[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "   Wait 20 seconds after sending a next bug report ! ");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /reportbug [text]");
    strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
    JustBugReported[playerid] = 1;
    SetTimerEx("BugReportReset", 20000, false, "i", playerid);
    format(string, sizeof(string), "Bug Report From [%d]%s: %s",playerid, sendername, params);
    SendTesterMessage(SCOLOR_GREEN, string);
    SendClientMessage(playerid, COLOR_YELLOW, "Your bug report message was sent to the online testers, thank you.");
    return 1;
}
Assuming string and sendername are declared as global according to your command.
Reply
#4

Alright thanks for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)