SA-MP Forums Archive
How can i make this so only "BLANK" can use the cmd. - 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: How can i make this so only "BLANK" can use the cmd. (/showthread.php?tid=122368)



How can i make this so only "BLANK" can use the cmd. - NewYorkRP - 21.01.2010

Код:
	else if(strcmp(PlayerName,"BLANK",true))
I''ve tried it, but everyone can use the command.


Re: How can i make this so only "BLANK" can use the cmd. - [nl]daplayer - 21.01.2010

If you read the documentation, you can see that strcmp returns not 1 when it's correct.

try this:
pawn Код:
else if(!strcmp(PlayerName,"BLANK",true))
the ! means that's not 1 :P

And BTW: make sure that PlayerName contains the playername.


Re: How can i make this so only "BLANK" can use the cmd. - NewYorkRP - 21.01.2010

Quote:
Originally Posted by Doom (NoZer0)
If you read the documentation, you can see that strcmp returns not 1 when it's correct.

try this:
pawn Код:
else if(!strcmp(PlayerName,"BLANK",true))
the ! means that's not 1 :P

And BTW: make sure that PlayerName contains the playername.
What do you mean by:
Код:
And BTW: make sure that PlayerName contains the playername.
at the top of it, i have :
Код:
  new PlayerName[24];
  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));



Re: How can i make this so only "BLANK" can use the cmd. - Deat_Itself - 21.01.2010

Код:
new PlayerName[24];
Код:
if(!strcmp(cmdtext, "/command" ,true))
{
if(strcmp(PlayerName,"BLANK",true))
     {
//your command goes here
}
return 1;
}
untested but it will work fine


Re: How can i make this so only "BLANK" can use the cmd. - NewYorkRP - 21.01.2010

I just need to know what will work, since you 2 gave me different things, it's weird.

pawn Код:
else if(strcmp(PlayerName,"BLANK",true))
    {
      if (PlayerToPoint(15, playerid,174.788970,-1350.784301,68.365165))
      {
       //command.
      }
      else { SendClientMessage(playerid, COLOR_GREY,"Destination is too far."); }
    }
So, how should i edit that ?


Re: How can i make this so only "BLANK" can use the cmd. - [nl]daplayer - 23.01.2010

Quote:
Originally Posted by NewYorkRP
I just need to know what will work, since you 2 gave me different things, it's weird.

pawn Код:
else if(strcmp(PlayerName,"BLANK",true))
    {
      if (PlayerToPoint(15, playerid,174.788970,-1350.784301,68.365165))
      {
       //command.
      }
      else { SendClientMessage(playerid, COLOR_GREY,"Destination is too far."); }
    }
pawn Код:
else if(!strcmp(PlayerName,"BLANK",true))
    {
      if (PlayerToPoint(15, playerid,174.788970,-1350.784301,68.365165))
      {
       //command.
      }
      else { SendClientMessage(playerid, COLOR_GREY,"Destination is too far."); }
    }
So, how should i edit that ?
so, try replace that piece with my piece of code.