Gate for 1 player
#1

Hello,
I am scripting a gate for only me
but how do i do that?
this is what i have:

Код:
new gate;
Код:
	gate = CreateObject(980,443.53085327,947.01824951,4.27847576,0.00000000,0.00000000,125.00000000);
Код:
	if (strcmp("/open", cmdtext, true, 10) == 0)
	{
	MoveObject(gate,443.53085327,947.01824951,-2.5,1.5);//
    	SendClientMessage(playerid, 0xFF9900AA, "Gate Open");
        	return 1;
	}
Reply
#2

Make the opening command so long no one else will even try to get in xD
Reply
#3

https://sampwiki.blast.hk/wiki/MovePlayerObject
This moves the object for only a single player.
Reply
#4

Use this change the "Your Name." to your name in game.
pawn Код:
if (strcmp("/open", cmdtext, true, 10) == 0)
{
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    if(!strcmp("Your Name.",PlayerName,true)) return 0;//Change: Your Name.
    MoveObject(gate,443.53085327,947.01824951,-2.5,1.5);
    SendClientMessage(playerid, 0xFF9900AA, "Gate Open");
    return 1;
}
Reply
#5

Quote:
Originally Posted by Clive
Посмотреть сообщение
Use this change the "Your Name." to your name in game.
pawn Код:
if (strcmp("/open", cmdtext, true, 10) == 0)
{
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    if(!strcmp("Your Name.",PlayerName,true)) return 0;//Change: Your Name.
    MoveObject(gate,443.53085327,947.01824951,-2.5,1.5);
    SendClientMessage(playerid, 0xFF9900AA, "Gate Open");
    return 1;
}
Thats really cool, Do you mind if i use it to?
Reply
#6

it doesnt work!
its says: SERVER:Unknown command.

these are my commands
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid,0); //KillCommand
		SetPlayerScore(playerid,GetPlayerScore(playerid) -1);
		SetPlayerWorldBounds(playerid, 945.9079, 326.9805, 1132.754, 688.9946);
		GameTextForPlayer(playerid, "You Comited Suicide", 1000, 1);
		return 1;
	}
	
	if (strcmp("/help", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid,COLOR_GREEN,".::.Rules.::.");
	    SendClientMessage(playerid,COLOR_YELLOW,"1. No cheating.");
	    SendClientMessage(playerid,COLOR_YELLOW,"2. Don't TeamKill.");
	    SendClientMessage(playerid,COLOR_YELLOW,"3. Don't go outside the DM zone.");
	    SendClientMessage(playerid,COLOR_GREEN,".::.Commands.::.");
	    SendClientMessage(playerid,COLOR_YELLOW,"/kill");
		return 1;
	}
	
	if (strcmp("/open", cmdtext, true, 10) == 0)
	{
  		new PlayerName[MAX_PLAYER_NAME];
  		GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  		if(!strcmp("Duckie",PlayerName,true)) return 0;
    	        MoveObject(gate,443.53085327,947.01824951,-2.5,1.5);
    	        SendClientMessage(playerid, 0xFF9900AA, "Gate Open");
   		return 1;
	}

	if (strcmp("/close", cmdtext, true, 10) == 0)
	{
		new PlayerName[MAX_PLAYER_NAME];
  		GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
   		if(!strcmp("Duckie",PlayerName,true)) return 0;
		MoveObject(gate,443.53085327,947.01824951,4.27847576,1.5);
		SendClientMessage(playerid, 0xFF9900AA, "Gate Closed");
		return 1;
	}

	return 0;
}
Reply
#7

Where is this gate located?

Please tell me that.
Reply
#8

i have fixed it!

Код:
	if (strcmp("/open", cmdtext, true, 10) == 0)
	{
  		new PlayerName[MAX_PLAYER_NAME];
  		GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  		if(!strcmp("Duckie",PlayerName,true)) return 0; <--- delete return 0;
    	        MoveObject(gate,443.53085327,947.01824951,-2.5,1.5);
    	        SendClientMessage(playerid, 0xFF9900AA, "Gate Open");
   		return 1;
	}
ps. its located here:



why do you ask that?
Reply
#9

Its fixed good.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)