SA-MP Forums Archive
Help with this GetPlayerName 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: Help with this GetPlayerName Cmd (/showthread.php?tid=90568)



Help with this GetPlayerName Cmd - Mishima - 08.08.2009

well i got this code

//AT THE TOP
new bool:Bros[MAX_PLAYERS];
Код:
	
  if(strcmp(cmd, "/brothers", true) == 0)
  {
    new PLName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PLName, sizeof(PLName));
    if(strcmp(PLName, "North", true) || strcmp(PLName, "Sonic", true))
    {
	  if(Bros == false)
	  {
  	    Bros = true;
      	MoveObject(corleonegate1, -2118.17, -80.35, 35.17,2);
      	MoveObject(corleonegate2, -2137.14, -80.35, 35.17,2);
      	SendClientMessage(playerid, COLOR_RED,"Gates Open");
      }
      else if(Bros == true)
    	  {
	    Bros = false;
      	MoveObject(corleonegate1, -2123.17, -80.35, 35.17,2);
      	MoveObject(corleonegate2, -2131.14, -80.35, 35.17,2);
      	SendClientMessage(playerid, COLOR_RED,"Gates Closed");
	  }
    }
 	else
	{
      SendClientMessage(playerid, COLOR_RED, "Sorry My Friend CMD Not For You ^^!");
	}
	return 1;
  }
but when i type this cmd with another nick it works too, its supposed tu work just for North And Sonic... help please?


Re: Help with this GetPlayerName Cmd - RaFsTar - 08.08.2009

Why don't u create a variable like GetPlayerBrothers and use dubd to save it and reload it on login ?


Re: Help with this GetPlayerName Cmd - ev0lution - 08.08.2009

Replace this:
Код:
if(strcmp(PLName, "North", true) || strcmp(PLName, "Sonic", true))
With this:
Код:
if(!strcmp(PLName, "North", true) || !strcmp(PLName, "Sonic", true))



Re: Help with this GetPlayerName Cmd - Mishima - 09.08.2009

Quote:
Originally Posted by ev0lutionnn
Replace this:
Код:
if(strcmp(PLName, "North", true) || strcmp(PLName, "Sonic", true))
With this:
Код:
if(!strcmp(PLName, "North", true) || !strcmp(PLName, "Sonic", true))
ok thanks it worked ^^