SA-MP Forums Archive
Help Please - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Please (/showthread.php?tid=274387)



Help Please - Alex_Obando - 05.08.2011

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.


Respuesta: Help Please - Alex_Obando - 05.08.2011

Just to see if im online :P


Re: Help Please - Rocketeer - 05.08.2011

How about just pressing tab


Re: Help Please - WoodPecker - 05.08.2011

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


Respuesta: Help Please - Alex_Obando - 05.08.2011

Because I need it.

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

Please help.


AW: Respuesta: Help Please - Nero_3D - 05.08.2011

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;
    }
}



Re: Help Please - iPLEOMAX - 05.08.2011

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.");
    }
}



Re: Help Please - Gh0sT_ - 05.08.2011

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.


Re: Help Please - omer5198 - 05.08.2011

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"