in-game id not working
#1

I am writing /pm [id] [text], and then tell the player is not online. Where can I look for a mistake or how specifically the rules of procedure will be? Sorry bad English...
Reply
#2

Search in your code
PHP код:
"CMD:pm" 
or "pm" until you found the command code.
Reply
#3

Existing command. All commands operate but will not work with the player id that even if the write / setlevel 4 and 5 it says that the player is not online.
Reply
#4

Mhm, i had same problem with sscanf parameter U, player is online, but after few hour of playing on server, it gets buggy, so i found a fix by ******, just add this to your gamemode:
PHP код:
SSCANF:u(name[])
{
    
// No name specified
    
if(isnull(name)) return INVALID_PLAYER_ID;
    new 
id;
    
// Was a part of name provided?
    
if(sscanf(name"i"id))
    {
        new 
matches;
        
// Find a player return the id
        
foreach(new Player)
        {
            
// Search for part of the players name
            
if(strfind(PlayerNames[i], nametrue) != -1)
            {
                
matches++;
                
id i;
                if(
matches 1) return INVALID_PLAYER_ID;
            }
        }
        
// Found a match
        
if(matches) return id;
        
// No player found return invalid player id
        
return INVALID_PLAYER_ID;
    }
    
// Player supplied a id
    // Make sure the id is greater than 0
    
if(id 0) return INVALID_PLAYER_ID;
    
// Make sure the id is connected
    
if(!IsPlayerConnected(id)) return INVALID_PLAYER_ID;
    
// Return the id
    
return id;

Reply
#5

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
Mhm, i had same problem with sscanf parameter U, player is online, but after few hour of playing on server, it gets buggy, so i found a fix by ******, just add this to your gamemode:
PHP код:
SSCANF:u(name[])
{
    
// No name specified
    
if(isnull(name)) return INVALID_PLAYER_ID;
    new 
id;
    
// Was a part of name provided?
    
if(sscanf(name"i"id))
    {
        new 
matches;
        
// Find a player return the id
        
foreach(new Player)
        {
            
// Search for part of the players name
            
if(strfind(PlayerNames[i], nametrue) != -1)
            {
                
matches++;
                
id i;
                if(
matches 1) return INVALID_PLAYER_ID;
            }
        }
        
// Found a match
        
if(matches) return id;
        
// No player found return invalid player id
        
return INVALID_PLAYER_ID;
    }
    
// Player supplied a id
    // Make sure the id is greater than 0
    
if(id 0) return INVALID_PLAYER_ID;
    
// Make sure the id is connected
    
if(!IsPlayerConnected(id)) return INVALID_PLAYER_ID;
    
// Return the id
    
return id;

Here is the problem?

PHP код:
if(matches 1) return INVALID_PLAYER_ID
I think it must be:

PHP код:
if(matches 1) return INVALID_PLAYER_ID
Reply
#6

Quote:
Originally Posted by diego200052
Посмотреть сообщение
Here is the problem?

PHP код:
if(matches 1) return INVALID_PLAYER_ID
I think it must be:

PHP код:
if(matches 1) return INVALID_PLAYER_ID
hmm, i dont think so, what will happen if there is more then 2 results, witch one will select for execute? thats just protection from something... if find 2+ results what should not happen
Reply
#7

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
hmm, i dont think so, what will happen if there is more then 2 results, witch one will select for execute? thats just protection from something... if find 2+ results what should not happen
But for example there are two players "Dusan01" and "Trucksan22" if one player writes /u san will found 2 matches and will return invalid id, this only happens if write a part of name but if write complete it's ok.
Reply
#8

Quote:
Originally Posted by diego200052
Посмотреть сообщение
But for example there are two players "Dusan01" and "Trucksan22" if one player writes /u san will found 2 matches and will return invalid id, this only happens if write a part of name but if write complete it's ok.
yeah, okay for that, but 90% of us is using IDs for players, but yeah, he can return something other, like type full name or something like that...

but this fix should work for bug witch he has saying to player is not connected, but he is connected...
Reply
#9

There is nothing wrong with sscanf's u specifier, I've been using it for years.
Post a command as an example, Hapukoorepakk.
Reply
#10

Quote:
Originally Posted by Stinged
Посмотреть сообщение
There is nothing wrong with sscanf's u specifier, I've been using it for years.
Post a command as an example, Hapukoorepakk.
I used it for years too, and only on 1 gamemode witch i used i had that problem, and same problem was reported to ****** and he sayd he know why is that happening and he posted that fix witch i posted here...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)