Help Please
#1

Hello, How I can do this:


If the server detects the name "Alex_Obando" and the player does /a then send the message "Alex_Obando is online"

Example:

Online Players: Alex_Obando & Mark_Weint.

Mark used the command /a
Alex_Obando is online.

Alex_Obando has left the server.
Mark used the command /a

Sorry Alex_Obando is not online.
Reply
#2

Just to see if im online :P
Reply
#3

How about just pressing tab
Reply
#4

May i ask you why you want this command since you can press TAB to see who is online?
Reply
#5

Because I need it.

Im scripting for a roleplay 400/500 so its hardly to find a player.

Please help.
Reply
#6

Quote:
Originally Posted by Alex_Obando
Посмотреть сообщение
Because I need it.

Im scripting for a roleplay 400/500 so its hardly to find a player.

Please help.
just search through all players, here a little example
pawn Код:
for(new i, name[MAX_PLAYER_NAME]; i != MAX_PLAYERS; ++i) {
    if(GetPlayerName(i, name, sizeof name) && strcmp(name, NEEDLE, true) == 0) {
        printf("Player found (id = %d)", i);
        break;
    }
}
Reply
#7

pawn Код:
//Put this in your command:
new name[MAX_PLAYER_NAME];
for( new i=0; i<MAX_PLAYERS; i++ )
{
    if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
    {
        GetPlayerName (i, name, sizeof(name) );
        if(!strcmp(name, "Alex_Obando", true)) return SendClientMessage(playerid, -1, "Alex is connected.");
    }
}
Reply
#8

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
pawn Код:
//Put this in your command:
new name[MAX_PLAYER_NAME];
for( new i=0; i<MAX_PLAYERS; i++ )
{
    if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
    {
        GetPlayerName (i, name, sizeof(name) );
        if(!strcmp(name, "Alex_Obando", true)) return SendClientMessage(playerid, -1, "Alex is connected.");
    }
}
You should not ignore case sens., there can be player with name AlEx_OBanDo or something else like this.
Reply
#9

Quote:
Originally Posted by Gh0sT_
Посмотреть сообщение
You should not ignore case sens., there can be player with name AlEx_OBanDo or something else like this.
he is right... just take this:
pawn Код:
new name[MAX_PLAYER_NAME];
for( new i=0; i<MAX_PLAYERS; i++ )
{
    if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
    {
        GetPlayerName (i, name, sizeof(name) );
        if(!strcmp(name, "Alex_Obando", false)) return SendClientMessage(playerid, -1, "Alex is connected.");
    }
}
the diffrence is in the last line... i turned "true" into "false" so it will notice between "a" and "A"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)