Need help with /playerinfo command
#1

Hello, uhh as you see, I was trying to make a /playerinfo command, that basically, gets the playerinfo that is specified, but I have been unsucessful, because of my bad coding, and not knowing what to do.

This is what it looks like

Код:
 if (strcmp("/playerinfo", cmdtext, true, 10) == 0 && IsPlayerAdmin(playerid))
 {
  tmp = strtok(cmdtext, idx);
	if(!strlen(tmp))
	{
	  SendClientMessage(playerid, 0xFF0000FF, "USAGE : /playerinfo ID");
	  return 1;
	}
	new giveplayerid = ReturnUser(tmp);
	if (giveplayerid != INVALID_PLAYER_ID)
	{
		new pName[MAX_PLAYER_NAME];
		new string[128];
	  new string1[128];
	  new string2[128];
	  new string3[128];
		{
	    SendClientMessage(playerid, 0xFF000A00, "-----------------------------------------------");
			format (string, sizeof(string), "Information of Player : %s",pName);
	    SendClientMessage(playerid, 0xFF0000FF, string);
	    SendClientMessage(playerid, 0xFF000A00, "-----------------------------------------------");
	    format (string1, sizeof(string1), "Armour : %i",GetPlayerArmour(playerid, 100.00);
	    SendClientMessage(playerid, 0xFAFAFAFA, string1);
	    format (string2, sizeof(string2), "Cash : %i",GetPlayerMoney(playerid);
	    SendClientMessage(playerid, 0xFAFAFAFA, string2);
	    format (string3, sizeof(string3), "Health : %i",GetPlayerHealth(playerid, 100.00);
			SendClientMessage(playerid, 0xFAFAFAFA, string3);
  			SendClientMessage(playerid, 0xFF000A00, "-----------------------------------------------");
		}
		else SendClientMessage(playerid, 0xFF0000FF, "This player isnt active !"
	}
	else return 0;
	return 1;
	}
	return 0;
}
for some reason I have a very strong feeling I did something wrong here, because this is what the compiler says :

Код:
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(160) : error 017: undefined symbol "idx"
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(166) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(179) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(179) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(181) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(183) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(183) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(187) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Justin\Desktop\SAMP\gamemodes\BGB_CLAN_GAMEMODE.pwn(187 -- 188) : error 001: expected token: ",", but found "}"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.
Also, this is the strtok function :

Код:
stock strtok(const string[], &index,seperator=' ')
{
	new length = strlen(string);
	new offset = index;
	new result[128];
	while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}

	result[index - offset] = EOS;
	if ((index < length) && (string[index] == seperator))
	{
		index++;
	}
	return result;
}
any help would be appreciated.
Reply


Messages In This Thread
Need help with /playerinfo command - by Hiitch - 05.08.2009, 19:33
Re: Need help with /playerinfo command - by Sergei - 05.08.2009, 19:37

Forum Jump:


Users browsing this thread: 1 Guest(s)