MATCH_NAME_PARTIAL -
AroseKhanNiazi - 14.08.2014
Y_ini
Code
pawn Код:
CMD:aka(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin])
{
new TargetID[3],i,string[256],IP[50];
if(sscanf(params,"u[3]",TargetID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /aka (Name/ID)");
for (i = 0; TargetID[i] != INVALID_PLAYER_ID; ++i)
{
if (TargetID[i] == cellmin)
{
format(string,sizeof(string),"%s Found In Multiple Names, Please Be More Specific.",TargetID);
SendClientMessage(playerid,COLOR_ERROR,string);
break;
}
}
if (i == 0)
{
format(string,sizeof(string),"%s Is Not a Valid Player/ID.",TargetID);
SendClientMessage(playerid,COLOR_ERROR,string);
}
if(i == 1)
{
GetPlayerIp(TargetID,IP,50);
format(string,sizeof(string),"|- %s's AKA -|", PlayerInfo[TargetID][pUserName]);
SendClientMessage(playerid,COLOR_BLUE,string);
format(string,sizeof(string),"|- Id: %d | Ip: %s | Names: %s -|", TargetID, pIP, INI_Load("/aka.txt",pIP));
return SendClientMessage(playerid,COLOR_BLUE,string);
}
}
else return 1;
return 1;
}
Errors
pawn Код:
(5213) : error 035: argument type mismatch (argument 1)
(5214) : error 033: array must be indexed (variable "TargetID")
(5216) : warning 213: tag mismatch
Line-Errors
pawn Код:
GetPlayerIp(TargetID,IP,50);//5213
format(string,sizeof(string),"|- %s's AKA -|", PlayerInfo[TargetID][pUserName]);//5214
format(string,sizeof(string),"|- Id: %d | Ip: %s | Names: %s -|", TargetID, pIP, INI_Load("/aka.txt",pIP));//5216
SSCANF
Code
pawn Код:
SSCANF_Option("MATCH_NAME_PARTIAL", 1);
Error
pawn Код:
error 021: symbol already defined: "SSCANF_Option"
What i wanted to script
First i needed to use "MATCH_NAME_PARTIAL" Feature of SSCANF2
Second I wanted to make an AKA System (Also Known As) So this is command with it i can't find any system with y_ini
Please Don't Post
https://github.com/Y-Less/sscanf/wiki/Users#user-lists and
https://github.com/Y-Less/sscanf/wiki/Settings#Global i have already read it and that's all i got to know, I searched On ****** got nothing
Re: Y_ini and sscanf -
Threshold - 14.08.2014
'new TargetID[3]'
Why is this even an array? You're confusing integers with arrays/strings. Use a separate variable for whatever you're trying to achieve..
Re: Y_ini and sscanf -
AroseKhanNiazi - 14.08.2014
Quote:
Originally Posted by Threshold
'new TargetID[3]'
Why is this even an array? You're confusing integers with arrays/strings. Use a separate variable for whatever you're trying to achieve..
|
actually i didn't even get it, it was on wiki of ******.
I just replaced ids(from his wiki) to TargetID
Re: Y_ini and sscanf -
Virtual1ty - 14.08.2014
Well TargetID is the playerid and not the player name. The "u" specifier in sscanf searches for connected players with a name or ID specified. An IPv4 address is 15 characters long + 1 for the NULL char. INI_Load isn't supposed to be used like that, I'm sure it needs a callback for the loaded data...
Re: Y_ini and sscanf -
AroseKhanNiazi - 14.08.2014
so how can i do what i want :/
Re: Y_ini and sscanf -
Virtual1ty - 14.08.2014
Not by using sscanf in this way my dear. If that's how I see it - you save player AKA names somewhere and want to check a players AKA names...
Re: Y_ini and sscanf -
AroseKhanNiazi - 14.08.2014
ok let take AKA part separate and MATCH_NAME_PARTIAL separate
pawn Код:
for (i = 0; TargetID[i] != INVALID_PLAYER_ID; ++i)
{
if (TargetID[i] == cellmin)
{
format(string,sizeof(string),"%s Found In Multiple Names, Please Be More Specific.",TargetID);
SendClientMessage(playerid,COLOR_ERROR,string);
break;
}
}
if (i == 0)
{
format(string,sizeof(string),"%s Is Not a Valid Player/ID.",TargetID);
SendClientMessage(playerid,COLOR_ERROR,string);
}
Re: Y_ini and sscanf -
Virtual1ty - 14.08.2014
TargetID is not a "string", it's a number! For the second time now.. It's also an array and you have to index it: TargetID[i]
Re: Y_ini and sscanf -
AroseKhanNiazi - 14.08.2014
ok any example ..... does the MATCH_NAME_PARTIAL work like this ?
Re: Y_ini and sscanf -
Virtual1ty - 14.08.2014
If you read through any of what I said, you would understand. I told you how to fix your errors and what they are, I don't have to provide any code - I would but I'm on a mobile.
Also, good night, I'm going to have my well deserved sleep now!