How do i make gate open and close? Please help me with this small thing
#10

Quote:
Originally Posted by Hillo
Посмотреть сообщение
It's not working, the gate isn't opening at all..


It gives these errors:
Код:
(17) : error 017: undefined symbol "GetPlayerPoolSize"
(21) : warning 211: possibly unintended assignment
(23) : error 017: undefined symbol "rx"
(23) : warning 215: expression has no effect
(23) : error 017: undefined symbol "rz"
(23) : warning 215: expression has no effect
(23) : error 001: expected token: ";", but found ")"
(23) : fatal error 107: too many error messages on one line
First of all, if you get the GetPlayerPoolSize error update your SA-MP server.

Both codes above by F1N4L and xTURBOx are incorrectly written and wrong.

You don't need to set the last 3 parameters (rx, ry, rx) because they have default value:
Код:
MoveDynamicObject(BDgate, -488.89850, -562.67981, 26, 3.0); 
MoveDynamicObject(BDgate, -488.89850, -562.67981, 25.35821, 3.0);
And this should be:
Код:
if (GateOpen == 0)
But you actually don't need to check if the gate is open, because this is automatic gate, not a command.
And you actually don't need to loop through all players. Just create the timer under OnPlayerSpawn or OnPlayerConnect.

This is how your code should look like:
Код:
// at the top of your script
new BDgate;

public OnGameModeInit()
{
	BDgate = CreateDynamicObject(988, -488.89850, -562.67981, 25.35821,   0.00000, 0.00000, 0.00000);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetTimer("BDGateCheck", 500, true);
	return 1;
}

forward BDGateCheck(playerid);
public BDGateCheck(playerid)
{
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	if(IsPlayerInRangeOfPoint(i, 5.0, -488.89850, -562.67981, 25.35821) && strcmp(name, "[BD]", true, 4))
	MoveDynamicObject(BDgate, -488.89850, -562.67981, 20, 3.0); // Open the gate
	else MoveDynamicObject(BDgate, -488.89850, -562.67981, 25.35821, 3.0); // Close the gate
	return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)