SA-MP Forums Archive
[FS] Help: Gate for PlayerName - 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: [FS] Help: Gate for PlayerName (/showthread.php?tid=229710)



[FS] Help: Gate for PlayerName - Niels_N - 22.02.2011

Sloved


Re: [FS] Help: Gate for PlayerName - Mike Garber - 22.02.2011

If I'm right strcmp returns false when two strings match. So try false)) instead of true)) on the strcmp part.


Re: [FS] Help: Gate for PlayerName - Niels_N - 22.02.2011

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
If I'm right strcmp returns false when two strings match. So try false)) instead of true)) on the strcmp part.
Wont work, The server says: SERVER: UNKNOWN COMMAND


AW: [FS] Help: Gate for PlayerName - Dusl12 - 22.02.2011

Код:
#include <a_samp>

new Poort1;
new PlayerName[24];

public OnFilterScriptInit()
{
	Poort1 = CreateObject(975,278.785736,-66.147872,1.578125,0.00000000,0.00000000,0.00000000);
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(Poort1);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	if(!strcmp(cmdtext, "/gateopen", true) && strcmp(PlayerName,"My_Name",true))
	{
		MoveObject(Poort1, 330.42218018,-62.15184784,0.59067321, 5);
		return 1;
	}
	if(!strcmp(cmdtext, "/gateclose", true) && strcmp(PlayerName,"My_Name",true))
	{
		MoveObject(Poort1, 278.785736,-66.147872,1.578125, 5);
		return 1;
	}
	return 0;
}
Maybe that OR:

Код:
#include <a_samp>

new Poort1;

public OnFilterScriptInit()
{
	Poort1 = CreateObject(975,278.785736,-66.147872,1.578125,0.00000000,0.00000000,0.00000000);
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(Poort1);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
	if(!strcmp(cmdtext, "/gateopen", true) && strcmp(name,"My_Name",true))
	{
		MoveObject(Poort1, 330.42218018,-62.15184784,0.59067321, 5);
		return 1;
	}
	if(!strcmp(cmdtext, "/gateclose", true) && strcmp(name,"My_Name",true))
	{
		MoveObject(Poort1, 278.785736,-66.147872,1.578125, 5);
		return 1;
	}
	return 0;
}
Greetings from Germany ^^


Re: AW: [FS] Help: Gate for PlayerName - Niels_N - 22.02.2011

Quote:
Originally Posted by Dusl12
Посмотреть сообщение
Код:
#include <a_samp>

new Poort1;
new PlayerName[24];

public OnFilterScriptInit()
{
	Poort1 = CreateObject(975,278.785736,-66.147872,1.578125,0.00000000,0.00000000,0.00000000);
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(Poort1);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	if(!strcmp(cmdtext, "/gateopen", true) && strcmp(PlayerName,"My_Name",true))
	{
		MoveObject(Poort1, 330.42218018,-62.15184784,0.59067321, 5);
		return 1;
	}
	if(!strcmp(cmdtext, "/gateclose", true) && strcmp(PlayerName,"My_Name",true))
	{
		MoveObject(Poort1, 278.785736,-66.147872,1.578125, 5);
		return 1;
	}
	return 0;
}
Maybe that OR:

Код:
#include <a_samp>

new Poort1;

public OnFilterScriptInit()
{
	Poort1 = CreateObject(975,278.785736,-66.147872,1.578125,0.00000000,0.00000000,0.00000000);
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(Poort1);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
	if(!strcmp(cmdtext, "/gateopen", true) && strcmp(name,"My_Name",true))
	{
		MoveObject(Poort1, 330.42218018,-62.15184784,0.59067321, 5);
		return 1;
	}
	if(!strcmp(cmdtext, "/gateclose", true) && strcmp(name,"My_Name",true))
	{
		MoveObject(Poort1, 278.785736,-66.147872,1.578125, 5);
		return 1;
	}
	return 0;
}
Greetings from Germany ^^
SERVER: UNKNOWN COMMAND


AW: [FS] Help: Gate for PlayerName - Dusl12 - 22.02.2011

Then try this:

Код:
#include <a_samp>

new Poort1;

public OnFilterScriptInit()
{
	Poort1 = CreateObject(975,278.785736,-66.147872,1.578125,0.00000000,0.00000000,0.00000000);
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(Poort1);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
	if(strcmp(cmdtext, "/gateopen", true)==0)
	{
                if(strcmp(name, "My_Name",true)==0)
                {
		        MoveObject(Poort1, 330.42218018,-62.15184784,0.59067321, 5);
		        return 1;
                }
                else
                {
                        SendClientMessage(playerid,0xFF0000FF,"You aren't My_Name!");
                        return 1;
                }
	}
	if(strcmp(cmdtext, "/gateclose", true)==0)
	{
                if(strcmp(name, "My_Name",true)==0)
                {
		        MoveObject(Poort1, 278.785736,-66.147872,1.578125, 5);
		        return 1;
                }
                else
                {
                        SendClientMessage(playerid,0xFF0000FF,"You aren't My_Name!");
                        return 1;
                }
	}
	return 0;
}



Re: [FS] Help: Gate for PlayerName - Niels_N - 22.02.2011

That works! Thanks!