COMMAND:gateopen(playerid, params[])
{
if(PlayerStat[playerid][Dead] == 1 || PlayerStat[playerid][InHospital] == 1) return SendClientMessage(playerid, GREY, "You are unconscious.");
if(PlayerStat[playerid][FactionID] < 1) return SendClientMessage(playerid, GREY, "You are not a Prison Guard/Doctor.");
if(IsPlayerInRangeOfPoint(playerid, 5, -21.93213, -338.94623, 7.83163) && gatestatus == 0)
{
new str[128];
gatestatus = 1;
MoveObject(gate, -21.93213, -338.94623, -4.83163, 1);
format(str, sizeof(str), "* %s opens the prison gate.", GetICName(playerid));
SendNearByMessage(playerid, ACTION_COLOR, str, 3);
}
return 1;
}
COMMAND:gateclose(playerid, params[])
{
if(PlayerStat[playerid][Dead] == 1 || PlayerStat[playerid][InHospital] == 1) return SendClientMessage(playerid, GREY, "You are unconscious.");
if(PlayerStat[playerid][FactionID] < 1) return SendClientMessage(playerid, GREY, "You are not a Prison Guard/Doctor.");
if(IsPlayerInRangeOfPoint(playerid, 5, -21.93213, -338.94623, 7.83163) && gatestatus == 1)
{
new str[128];
gatestatus = 0;
MoveObject(gate, -21.93213, -338.94623, 7.83163, 1);
format(str, sizeof(str), "* %s closes the prison gate.", GetICName(playerid));
SendNearByMessage(playerid, ACTION_COLOR, str, 3);
}
return 1;
}
COMMAND:gate(playerid, params[])
{
if(PlayerStat[playerid][Dead] == 1 || PlayerStat[playerid][InHospital] == 1) return SendClientMessage(playerid, GREY, "You are unconscious.");
if(PlayerStat[playerid][FactionID] < 1) return SendClientMessage(playerid, GREY, "You are not a Prison Guard/Doctor.");
if(IsPlayerInRangeOfPoint(playerid, 5, -21.93213, -338.94623, 7.83163))
{
switch(gatestatus)
{
case 0:
{
new str[128];
gatestatus = 1;
MoveObject(gate, -21.93213, -338.94623, -4.83163, 1);
format(str, sizeof(str), "* %s opens the prison gate.", GetICName(playerid));
SendNearByMessage(playerid, ACTION_COLOR, str, 3);
}
case 1:
{
new str[128];
gatestatus = 0;
MoveObject(gate, -21.93213, -338.94623, 7.83163, 1);
format(str, sizeof(str), "* %s closes the prison gate.", GetICName(playerid));
SendNearByMessage(playerid, ACTION_COLOR, str, 3);
}
}
}
return 1;
}
new GateOpened = 0;
COMMAND:gate(playerid, params[])
{
if(PlayerStat[playerid][Dead] == 1 || PlayerStat[playerid][InHospital] == 1) return SendClientMessage(playerid, GREY, "You are unconscious.");
if(PlayerStat[playerid][FactionID] < 1) return SendClientMessage(playerid, GREY, "You are not a Prison Guard/Doctor.");
if(GateOpened == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 5, -21.93213, -338.94623, 7.83163) && gatestatus == 0)
{
new str[128];
gatestatus = 1;
MoveObject(gate, -21.93213, -338.94623, -4.83163, 1);
format(str, sizeof(str), "* %s opens the prison gate.", GetICName(playerid));
SendNearByMessage(playerid, ACTION_COLOR, str, 3);
GateOpened = 1;
}
}
else if(GateOpened == 1)
{
// Closing gate functions
GateOpened = 0;
}
return 1;
}
|
Write this up the OnGameModeInit:
PHP код:
PHP код:
|