[Duda] stock ReturnUser(text[])...
#1

Buenas a Todos, Alguien me podria decir para ke sirve este stock y un ejemplo como utilizarlo?.

Desde ya muchas gracias.

PHP код:
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 >=&& 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 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            
GetPlayerName(inamesizeof(name));
            if(
strcmp(nametext[pos], truelen) == 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
#2

Devuelve el id de un usuario en base al id ingresado (algo obvio), el nombre, o parte del nombre.
Reply
#3

mirando bien si, es el tipico ReturnUser pero mas elaborado xDD, es ke me hizo confundir por ke le pusieron text[] XDD :P.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)