return user ;
giveplayerid = ReturnUser(tmp);
3.
pawn Код:
@AK: Your code obviously didn't work |
public CallbackName ( ) {
return user ;
}
new
ReturnUser = strval(params);
firstly i though u returning the file as
pawn Код:
secondly i don't even know thats was the code.. EDIT: pawn Код:
|
if(strcmp(cmd, "/id", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "Fehler: /id [playerid]");
SendClientMessage(playerid, COLOR_YELLOW, "Funktion: Um die ID eines Spielers zu sehen.");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
new sstring[256];
new ip[128];
GetPlayerIp(giveplayerid,ip,128);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(sstring, sizeof(sstring), "-| %s's IP: %s |-", giveplayer,ip);
SendClientMessage(playerid,COLOR_LIGHTBLUE, sstring);
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_RED, string);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not an admin.");
}
return 1;
}
Wait... Can you explain what you are trying to do? What is "ReturnUser" used for in your script?
And what Is ReturnUser? Never heard of it. |
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21) // Strip out leading spaces
{
if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos])) // Check whole passed string
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
userid = INVALID_PLAYER_ID;
}
else
{
return userid;
}
}
}
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof (name));
if (strcmp(name, text[pos], true, len) == 0)
{ if (len == strlen(name)) { return i;
} else {
count++;
userid = i;
} } } } if (count != 1)
{ if (playerid != INVALID_PLAYER_ID)
{ if (count)
{ SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
} else { SendClientMessage(playerid, 0xFF0000AA, "No matching user found");}
} userid = INVALID_PLAYER_ID; } return userid;
}