Open doors with one cmd
#1

Hi, all!
So I made a 4 cmds for door opening and closing. Maybe someone can help. I wanna make a one cmd for doors.


cmds
Код:
CMD:old(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");{
		MoveObject(LoungeRoom, 163.88570, 2508.83838, -89.91240, 2.0);
	}
	return 1;
}

CMD:cld(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");{
		MoveObject(LoungeRoom, 163.88570, 2510.17822, -89.91240, 2.0);
	}
	return 1;
}

CMD:ogd(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");{
		MoveObject(GuardRoom, 166.34940, 2489.65137, -89.93290, 2.0);
	}
	return 1;
}

CMD:cgd(playerid, params[])
{
	if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");{
		MoveObject(GuardRoom, 167.66940, 2489.65137, -89.93290, 2.0);
	}
	return 1;
}
.. and "some shits"
Код:
new GuardRoom;
new LoungeRoom;

GuardRoom = CreateObject(1495, 167.66940, 2489.65137, -89.93290, 0.00000, 0.00000, 0.00000);
LoungeRoom = CreateObject(1495, 163.88570, 2510.17822, -89.91240, 0.00000, 0.00000, 90.00000);
Plz help, I want to learn how to create this type of commands.
Reply
#2

Try this
Код:
CMD:gate(playerid, params[])
if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're near any door!!");{
		MoveObject(LoungeRoom, 163.88570, 2508.83838, -89.91240, 2.0);}

else if(IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240))// return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");{
		MoveObject(LoungeRoom, 163.88570, 2510.17822, -89.91240, 2.0);
	}

else if(IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) //return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");{
		MoveObject(GuardRoom, 166.34940, 2489.65137, -89.93290, 2.0);
	}
else if(IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) //return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");{
		MoveObject(GuardRoom, 167.66940, 2489.65137, -89.93290, 2.0);
	}
Just try It Im not a pro scripter So It maybe will not work Just give it a try
Reply
#3

pawn Код:
CMD:door(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240))
    {
        SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");
        MoveObject(LoungeRoom, 163.88570, 2508.83838, -89.91240, 2.0);
    }
    else if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141))
    {
        SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");
        MoveObject(GuardRoom, 166.34940, 2489.65137, -89.93290, 2.0);
    }
    else if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240))
    {
        SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");
        MoveObject(LoungeRoom, 163.88570, 2510.17822, -89.91240, 2.0);
    }
    else if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141))
    {
        SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");
        MoveObject(GuardRoom, 167.66940, 2489.65137, -89.93290, 2.0);
    }
    return 1;
}
Reply
#4

I would prefer using it with names, it makes it easier. You can use /opendoor <name> and it will move each door according to the name.

pawn Код:
CMD:opendoor(playerid, params[])
{
    if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /opendoor <old/cld/ogd/cgd>");
    if (!strcmp(params, "old", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");
        MoveObject(LoungeRoom, 163.88570, 2508.83838, -89.91240, 2.0);
    }
    else if (!strcmp(params, "cld", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");
        MoveObject(LoungeRoom, 163.88570, 2510.17822, -89.91240, 2.0);
    }
    else if (!strcmp(params, "ogd", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");
        MoveObject(GuardRoom, 166.34940, 2489.65137, -89.93290, 2.0);
    }
    else if (!strcmp(params, "cgd", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");
        MoveObject(GuardRoom, 167.66940, 2489.65137, -89.93290, 2.0);
    }
    else SendClientMessage(playerid, -1, "Valid names: old, cld, ogd and cgd");
    return 1;
}
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I would prefer using it with names, it makes it easier. You can use /opendoor <name> and it will move each door according to the name.

pawn Код:
CMD:opendoor(playerid, params[])
{
    if (isnull(params)) return SendClientMessage(playerid, -1, "Usage: /opendoor <old/cld/ogd/cgd>");
    if (!strcmp(params, "old", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");
        MoveObject(LoungeRoom, 163.88570, 2508.83838, -89.91240, 2.0);
    }
    else if (!strcmp(params, "cld", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 163.88570, 2510.17822, -89.91240)) return SendClientMessage(playerid, lightblue, "You're not at lounge room enterance!");
        MoveObject(LoungeRoom, 163.88570, 2510.17822, -89.91240, 2.0);
    }
    else if (!strcmp(params, "ogd", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");
        MoveObject(GuardRoom, 166.34940, 2489.65137, -89.93290, 2.0);
    }
    else if (!strcmp(params, "cgd", true))
    {
        if(!IsPlayerInRangeOfPoint(playerid, 1.8, 168.4030,2489.5740,-88.9141)) return SendClientMessage(playerid, lightblue, "You're not at Guard office enterance!");
        MoveObject(GuardRoom, 167.66940, 2489.65137, -89.93290, 2.0);
    }
    else SendClientMessage(playerid, -1, "Valid names: old, cld, ogd and cgd");
    return 1;
}
Yeah.. I think this will be better.


Thank you all, for support.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)