SA-MP Forums Archive
AKA CMD - 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: AKA CMD (/showthread.php?tid=652380)



AKA CMD - Hunud - 09.04.2018

Suprise. It's me again...

What the hell is the problem with this command, I'm geting some errors in format line

Код:
error 029: invalid expression, assumed zero
 error 017: undefined symbol "name"
error 001: expected token: ";", but found "return"
 fatal error 107: too many error messages on one line
Код:
CMD:aka(playerid,params[])
{
	new player1, playername[MAX_PLAYER_NAME], str[128], ip[16];
	player1 = strval(params);
 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
 	{
	  	GetPlayerIp(player1, ip, sizeof(ip));
		format(str,sizeof(str),"|- %s's AKA -|", GetName(player1));
        SendClientMessage(playerid,-1,str);
	    format(str,sizeof(str), "Id: %d Ip: %s Names: %s", GetName(player1), ip, INI_Int("/Korisnici/%s.ini",ip));
        SendClientMessage(playerid, -1, str);
	}
	else return SendClientMessage(playerid, -1, "Player is not connected or is yourself");
	return 1;
}



Re: AKA CMD - MattL019 - 09.04.2018

Please add line numbers with your error code and the actual code itself. For all we know the errors could be talking about something elsewhere in the script.


Re: AKA CMD - CutX - 09.04.2018

Quote:
Originally Posted by Hunud
Посмотреть сообщение
Suprise. It's me again...

What the hell is the problem with this command, I'm geting some errors in format line

Код:
error 029: invalid expression, assumed zero
 error 017: undefined symbol "name"
error 001: expected token: ";", but found "return"
 fatal error 107: too many error messages on one line
Код:
CMD:aka(playerid,params[])
{
	new player1, playername[MAX_PLAYER_NAME], str[128], ip[16];
	player1 = strval(params);
 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
 	{
	  	GetPlayerIp(player1, ip, sizeof(ip));
		format(str,sizeof(str),"|- %s's AKA -|", GetName(player1));
        SendClientMessage(playerid,-1,str);
	    format(str,sizeof(str), "Id: %d Ip: %s Names: %s", GetName(player1), ip, INI_Int("/Korisnici/%s.ini",ip));
        SendClientMessage(playerid, -1, str);
	}
	else return SendClientMessage(playerid, -1, "Player is not connected or is yourself");
	return 1;
}
you can't do that (%s) here
PHP код:
INI_Int("/Korisnici/%s.ini",ip
you have to format the string first if you want to get the ip/name after the '/'

despite that the rest of that format is also kind of wrong.
Quote:
Код:
format(str,sizeof(str), "Id: %d Ip: %s Names: %s", GetName(player1), ip, INI_Int("/Korisnici/%s.ini",ip));
1. you expect a id, a Number but you offer the name (string)
3. expect (probably, guessing) multiple names, but only offer return code of INI_Int, no actual string of names

so that's that. you should know what to do


Re: AKA CMD - Hunud - 09.04.2018

Sounds hard to me as well. I'll try but not going to promise anything