[Solved] How to make something only work for names?
#1

Hey! Please help me out if you now how to do

I have some mins ago made a hq for myself with a timergate, my friend, [NWA]top has asked me to make a hq for him.
Now he isnt an admin so it wont be that easy like it was on my other gate. (If(isplayeradmin))
The question is, is there possible to make something work for names?
Like this:
Код:
if(strcmp("/topgate",cmd,true)==0)
{
  if(name == [NWA]top)
  {
    SetTimer("OpenTopsGate",500,false);
    return 1;
  }
  return 1;
}
If this is possible, please help me out, Please
Reply
#2

pawn Код:
if(strcmp("/topgate",cmd,true)==0)
{
  new playername[MAX_PLAYER_NAME];
  GetPlayerName(playerid, playername, sizeof(playername));
  if(strcmp(playername, "[NWA]top") == 0)
  {
    SetTimer("OpenTopsGate",500,false);
    return 1;
  }
  return 1;
}
Reply
#3

Ok if this hq was for 2 people, so 2 people can open the gate, would the script look like no. 1 or no. 2 or something else (Please , post here)
Number 1:
Код:
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    
	  if(strcmp(playername, "[NWA]top" || "[NWA]WSD")==0)
	  {
      SetTimer("OpenTopsGate",500,false);
      return 1;
      }
Number 2:
Код:
    new playername[MAX_PLAYER_NAME];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    GetPlayerName(playerid, playername2, sizeof(playername2));
    
	  if(strcmp(playername, "[NWA]top")==0)
	  {
      SetTimer("OpenTopsGate",500,false);
      return 1;
      }

      if(strcmp(playername, "[NWA]WSD")==0)
	  {
      SetTimer("OpenTopsGate",500,false);
      return 1;
      }
Thanks in advance
Reply
#4

pawn Код:
if(strcmp("/topgate",cmd,true)==0)
{
  new playername[MAX_PLAYER_NAME];
  GetPlayerName(playerid, playername, sizeof(playername));

  if(strcmp(playername, "[NWA]top") == 0 || strcmp(playername, "[NWA]WSD") == 0)
  {
    SetTimer("OpenTopsGate",500,false);
    return 1;
  }
  return 1;
}
Reply
#5

Thanks a lot! It works now! I'm really happy! Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)