SA-MP Forums Archive
Is there anyway of making a command work for a name? - 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)
+--- Thread: Is there anyway of making a command work for a name? (/showthread.php?tid=528426)



Is there anyway of making a command work for a name? - MoeSal - 27.07.2014

Hi guys I'm trying to map an admin base atm and I've made an island that I want the gates to only open for "Moe". Is there anyway of me doing that and if your name isn't Moe, it'll return "Your not Moe, so for that you can't enter"
Here's my current command.

Код:
	if (strcmp("/mog", cmdtext, true, 10) == 0)
        if(IsPlayerInRangeOfPoint(playerid, 20, 867.57, -3287.05, 5.82))
	{
				MoveObject(MoeGateRight, 879.62, -3279.54, 6.57, 2);
				MoveObject(MoeGateLeft, 856.17, -3280.41, 6.57, 2);
				MoveObject(MoeGateUp, 867.80, -3279.98, 12.42, 2);
				MoveObject(MoeGateDown, 867.80, -3279.98, 0.60, 2);
	 		   	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Succesfully Opened The Gate To Moe's Private Island!");
				return 1;
		        }
	if (strcmp("/mcg", cmdtext, true, 10) == 0)
        if(IsPlayerInRangeOfPoint(playerid, 20, 867.57, -3287.05, 5.82))
	{
				MoveObject(MoeGateRight, 867.80, -3279.98, 6.57, 2);
				MoveObject(MoeGateLeft, 867.80, -3279.98, 6.57, 2);
				MoveObject(MoeGateUp, 867.80, -3279.98, 6.57, 2);
				MoveObject(MoeGateDown, 867.80, -3279.98, 6.57, 2);
	 		   	SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Succesfully Closed The Gate To Moe's Private Island!");
				return 1;
        }



Re: Is there anyway of making a command work for a name? - Don_Cage - 27.07.2014

pawn Код:
CMD:something(playerid, params[])
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(!strcmp(name,"name"))
    {
        /*
        Do something
        */

    }
    else return SendClientMessage(playerid, -1, "You're not blahblah");
    return true;
}



Re: Is there anyway of making a command work for a name? - MoeSal - 28.07.2014

That didn't work for me


Re: Is there anyway of making a command work for a name? - Don_Cage - 28.07.2014

Post the code.
The one where you added what I posted


Re: Is there anyway of making a command work for a name? - Pulsefire - 28.07.2014

Did you change the actual name to your name?