SA-MP Forums Archive
playe name command - 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: playe name command (/showthread.php?tid=161409)



playe name command - BlackRock - 19.07.2010

how make that is player name is ex: troy

and command like this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

if (strcmp(cmdtext, "/troyhouse", true)==0 && IsPlayerAdmin(playerid))
{
SetPlayerPos(playerid, 2018.2966, 1916.3411, 12.3418);
return 1;
}
i mean i want that commands only access this player with name troy not admin, are is possible?
and error message is this ;you cannot teleport because your name is not troy! or something like that!


Re: playe name command - klavins21 - 19.07.2010

new Nick[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nick, sizeof(Nick));
if(strfind(Nick, "troy", false) != -1)


Re: playe name command - BlackRock - 20.07.2010

whre i but this code?


Re: playe name command - PotH3Ad - 20.07.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/troyhouse", true) == 0)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        if(strfind(pName, "Troy", true) != -1)
        {
            SetPlayerPos(playerid, 2018.2966, 1916.3411, 12.3418);
        }
        else return SendClientMessage(playerid, 0xFFFFFF, "Your name must be \"Troy\" to teleport!");
    }
    return 0;
}



Re: playe name command - BlackRock - 20.07.2010

you forgot something

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/troyhouse", true) == 0)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        if(strfind(pName, "Troy", true) != -1)
        {
            SetPlayerPos(playerid, 2018.2966, 1916.3411, 12.3418);
        }
        else return SendClientMessage(playerid, 0xFFFFFF, "Your name must be \"Troy\" to teleport!");

		return 1;
	}
	return 0;
}