help + rep
#1

Untitled.pwn(23566) : warning 202: number of arguments does not match definition

Quote:

if (Players == 0)
return SendClientMessage(playerid, COLOR_ERROR, "No Players Close Enough To Pet Slap.");

}else{
if (!isNumeric(tmp))
{
TargetID = ReturnUser(tmp,playerid); //Here Is Line 23566
if (TargetID == INVALID_PLAYER_ID)
{
return 1;
}
}
else
{
TargetID = strval(tmp);

if (!IsPlayerConnected(TargetID))
{
format(string, sizeof(string), "%d Is Not A Valid ID.", TargetID);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
}
}

Reply
#2

Quote:

new targetID = ReturnUser(tmp,playerid);

ignore this my bad didnt noticed the warning message above
Reply
#3

Show us your ReturnUser function.
Reply
#4

Quote:
Originally Posted by lackmail
Посмотреть сообщение
new targetID = ReturnUser(tmp,playerid);
Wrong, the error isn't "undefined symbol". Nice guess though.


Show us the function "ReturnUser", alternatively look at it and see which arguments you are missing when calling.

I'm guessing there is no need to pass the playerid, since the function is probably used to get that.
Reply
#5

bump..

Quote:

/----------------------------------------------------------

#define RETURN_USER_FAILURE -1
#define RETURN_USER_MULTIPLE -2

stock ReturnUser(text[])
{
new pos = 0;
new userid = RETURN_USER_FAILURE;

while(text[pos] < 0x21) { // Strip out leading spaces
if(text[pos] == 0) return RETURN_USER_FAILURE; // No passed text
pos++;
}

if(isNumeric(text[pos])) { // Check whole passed string
userid = strval(text[pos]);
if(userid >=0 && userid < MAX_PLAYERS)
{
if(IsPlayerConnected(userid)) return userid;
return RETURN_USER_FAILURE;
}
}

// They entered [part of] a name or the id search failed (check names just incase)
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME+1];

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof(name));
if(strcmp(name, text[pos], true, len) == 0) // Check segment of name
{
if(len == strlen(name)) { // Exact match
return i;
}
else { // Partial match
count++;
userid = i;
}
}
}
}

if(!count) return RETURN_USER_FAILURE;
if(count > 1) return RETURN_USER_MULTIPLE;

return userid;
}

//----------------------------------------------------------

Reply
#6

Think outside the box. Start using sscanf. The godfather script and its immediate derivatives are a source of bad practices. These methods may have been fine ten years ago (literally) but today much better, faster and easier methods are available.
Reply
#7

thank you , it fixed how can i give you rep now?
Reply
#8

Quote:

thank you , it fixed how can i give you rep now?

Haha that's funny dude, now I think the whole thread meant for "How to +rep" from the title help +rep...ing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)