Help Make Commands For Player Name
#1

How can i make commands for 2 players name because i need a commands that for me and mine friend =.=
Reply
#2

An example

pawn Код:
if (strcmp(cmdtext, "/mycommand", true) == 0)    
{    
         new pname[MAX_PLAYER_NAME];  
         GetPlayerName(playerid,pname,sizeof(pname));
         if(!strcmp(pname, "YOUR NICK"))    
        {    
               SendClientMessage(playerid, -1, "OWNED");    
        }    
               else    
       {    
       SendClientMessage(playerid, -1, "NOT OWNED!");    
}    
return 1;    
}
Reply
#3

wait wut ?
Reply
#4

if(!strcmp(pname, "YOUR NICK")) put your nick and the command will only work for you ...
Reply
#5

i need for 2 player :\
i should do Else if for another guys ?
Reply
#6

So try

pawn Код:
if (strcmp(pname,"NICK",true)==0 || strcmp(pname,"NICK2",true)==0)

sorry for the inconvenience ^^
Reply
#7

pawn Код:
if (strcmp(cmdtext, "/yourcommand", true) == 0)    
{    
       new pname[MAX_PLAYER_NAME];  
       GetPlayerName(playerid,pname,sizeof(pname));
       if(strcmp(sendername,"Your_name",true)==0 || strcmp(sendername,"Friends_name",true)==0)    
       {    
               //your_code
       }    
       else{    
            SendClientMessage(playerid, -1, "Server: Unknown Command");    
       }
 
       return 1;    
}
Reply
#8

okay =)
Reply
#9

283.91,-1146.53,80.91

my place of Armoury how can i add the Place player must be in this 283.91,-1146.53,80.91 to use the commands ?
Reply
#10

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 283.91, -1146.53, 80.91)) //here 5.0 is the range of the point in which he can use the cmd
{
    // do this this and this
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)