#1

is it possible to make an command only working for 1 guy ? i mean somehow put his name in the command that it only works then
Reply
#2

Yes, it's possible
Reply
#3

Quote:
Originally Posted by Bikken
Посмотреть сообщение
Yes, it's possible
how...
Reply
#4

you can create a bool that when the player connects it checks his name and/or ip and if its the player you want it to work just turn the flag true. then in the cmd the first line make if (!Flag) return SendClienteMessage.... bla bla
Reply
#5

Quote:
Originally Posted by P3DRO
Посмотреть сообщение
you can create a bool that when the player connects it checks his name and/or ip and if its the player you want it to work just turn the flag true. then in the cmd the first line make if (!Flag) return SendClienteMessage.... bla bla
uhm this doesnt help me at all u just talking cr@p bro.
Reply
#6

or you can check the names when the player uses the command...

Example:
pawn Код:
CMD:mycommand(playerid, params[])
{
    new playersname[MAX_PLAYER_NAME]; //Used to store the player's name
    GetPlayerName(playerid, playersname, MAX_PLAYER_NAME); //Save the player's name to the variable
    if(strcmp(playersname, "BenzoAMG", true) != 0) return SendClientMessage(playerid, 0xFF0000FF, "Only BenzoAMG can use this command!");
    //rest of the command here
    return 1;
}
if(strcmp(playersname, "BenzoAMG", true)) means if you compare the string of the player's name and BenzoAMG, if they are not the same, they do not equal 0. If they match however, it DOES equal 0, and the command will continue.
Reply
#7

pawn Код:
new name[MAX_PLAYER_NAME];
In the command:
pawn Код:
GetPlayerName(playerid, name, sizeof(name));
if(!strcmp(name, "Your_name", true))
{
    //your codes
}
EDIT - @BenzoAMG : saw your post after I posted.
Reply
#8

Of course, you can!
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( !strcmp( cmdtext, "/hello", true ) )
    {
        new
            name[ MAX_PLAYER_NAME ]
        ;
        GetPlayerName( playerid, name, MAX_PLAYER_NAME );
       
        if( !strcmp( name, "kepa333", true ) ) SendClientMessage( playerid, -1, "Hello kepa333!" );
        else SendClientMessage( playerid, -1, "You're not kepa333." );
        return 1;
    }
    return 0;
}
EDIT: I was too late. Anyway!
Reply
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Of course, you can!
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( !strcmp( cmdtext, "/hello", true ) )
    {
        new
            name[ MAX_PLAYER_NAME ]
        ;
        GetPlayerName( playerid, name, MAX_PLAYER_NAME );
       
        if( !strcmp( name, "kepa333", true ) ) SendClientMessage( playerid, -1, "Hello kepa333!" );
        else SendClientMessage( playerid, -1, "You're not kepa333." );
        return 1;
    }
    return 0;
}
EDIT: I was too late. Anyway!
i did this

PHP код:
    if(!strcmp(cmdtext"/shayopen"true)) // By dylan
    
{
        if(
IsPlayerConnected(playerid))
        {
            if(
IsPlayerInRangeOfPoint(playerid15311.20001220703, -1141.900024414186.199996948242) || IsPlayerInRangeOfPoint(playerid6,311.8377,-1142.1458,5028.0552))
            {
                  new
                    
nameMAX_PLAYER_NAME ]
                ;
                
GetPlayerNameplayeridnameMAX_PLAYER_NAME );
                if( !
strcmpname"kepa333"true ) ) SendClientMessageplayerid, -1"Hello keppa!" );
                else 
SendClientMessageplayerid, -1"You're not kepa." );
                if(
shay1 == 0)
                {
                      
MoveDynamicObject(shaygate1,  311.89999389648, -1142.80004882815026.550.7500);
                      
SendClientMessage(playeridCOLOR_BLUE,"Gate is open");
                      
GetPlayerName(playeridsendernamesizeof(sendername));
                      
format(stringsizeof(string), "* %s takes his/her remote control and opens Gate."sendername);
                      
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                      
shay1 1;
                }
                else
                {
                      
MoveDynamicObject(shaygate1,  311.20001220703, -1141.900024414150.19999694824250.0000);
                      
SendClientMessage(playeridCOLOR_BLUE,"Gate is closed");
                      
GetPlayerName(playeridsendernamesizeof(sendername));
                      
format(stringsizeof(string), "* %s takes his/her remote control and closes Gate."sendername);
                      
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                      
shay1 0;
                }
            }
        }
        return 
1;
    } 
it does show that im not the right guy but it still opens...
help me out of here pls
Reply
#10

Quote:
Originally Posted by kepa333
Посмотреть сообщение
i did this

PHP код:
    if(!strcmp(cmdtext"/shayopen"true)) // By dylan
    
{
        if(
IsPlayerConnected(playerid))
        {
            if(
IsPlayerInRangeOfPoint(playerid15311.20001220703, -1141.900024414186.199996948242) || IsPlayerInRangeOfPoint(playerid6,311.8377,-1142.1458,5028.0552))
            {
                  new
                    
nameMAX_PLAYER_NAME ]
                ;
                
GetPlayerNameplayeridnameMAX_PLAYER_NAME );
                if( !
strcmpname"kepa333"true ) ) SendClientMessageplayerid, -1"Hello keppa!" );
                else 
SendClientMessageplayerid, -1"You're not kepa." );
                if(
shay1 == 0)
                {
                      
MoveDynamicObject(shaygate1,  311.89999389648, -1142.80004882815026.550.7500);
                      
SendClientMessage(playeridCOLOR_BLUE,"Gate is open");
                      
GetPlayerName(playeridsendernamesizeof(sendername));
                      
format(stringsizeof(string), "* %s takes his/her remote control and opens Gate."sendername);
                      
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                      
shay1 1;
                }
                else
                {
                      
MoveDynamicObject(shaygate1,  311.20001220703, -1141.900024414150.19999694824250.0000);
                      
SendClientMessage(playeridCOLOR_BLUE,"Gate is closed");
                      
GetPlayerName(playeridsendernamesizeof(sendername));
                      
format(stringsizeof(string), "* %s takes his/her remote control and closes Gate."sendername);
                      
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                      
shay1 0;
                }
            }
        }
        return 
1;
    } 
it does show that im not the right guy but it still opens...
help me out of here pls
solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)