Converting to DCMD
#1

Can anybody convert this correctly to DCMD or something, because I tried several of times and I failed..

pawn Код:
if(strcmp(cmd, "/gate", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,9,1588.3058,-1637.9652,13.4227))
        { //POLICE GATE
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgategar==0)
            {
                pdgategar = 1;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 7.710285, 1.50);
                return 1;
            }
            else if(pdgategar==1)
            {
                pdgategar = 0;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 15.260185, 1.50);
                return 1;
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
        { //POLICE BAR
            if(!IsACop(playerid)&& !IsAnAgent(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SAST !");
            if(pdgatebar==0)
            {
                pdgatebar = 1;
                SetObjectRot( pdbarriergateobj, 0.0000, 360.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.953003, 13.079567 );
                return 1;
            }
            else if(pdgatebar==1)
            {
                pdgatebar = 0;
                SetObjectRot( pdbarriergateobj, 0.0000, 90.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.980000, 13.215000 );
                return 1;
            }
        }
        if(IsPlayerInRangeOfPoint(playerid,9,1269.7087,-914.3023,42.3584))
        { //FAMILY 5 & Tye Spencer GATE
            if(PlayerInfo[playerid][pFMember] != 5)
            if(tyespencer == 0)
            {
                tyespencer = 1;
                MoveDynamicObject(tyespencergateobj, 1269.73205566,-913.85491943,36.03096771,1.50);
                return 1;
            }
            else if(tyespencer == 1)
            {
                tyespencer = 0;
                MoveDynamicObject(tyespencergateobj, 1269.50585938,-913.93554688,43.37343216,1.50);
                return 1;
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,96.8500, 1923.4334, 15.3518))
        { //PRISON GATE
            if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 5 && !IsAnAgent(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SAST / PG !");
            if(Prison_Buttons[GateOpened] == 0)
            {
                MoveDynamicObject(Prison_Buttons[PrisonGate], 96.808670, 1923.5, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 1;
                Prison_Buttons[GateTimerID]= SetTimer("PrisonGateCheck", 60000, 0);
            }
            else
            {
                MoveDynamicObject(Prison_Buttons[PrisonGate], 96.808670, 1920.512817, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 0;
                KillTimer(Prison_Buttons[GateTimerID]);
            }
        }
        for(new g=0;g<MAX_GATES;g++)
        {
            new Float:gaX, Float:gaY, Float:gaZ;
            GetDynamicObjectPos(GateInfo[g][gID], gaX, gaY, gaZ);
            if(IsPlayerInRangeOfPoint(playerid, GateInfo[g][gRange], gaX,gaY,gaZ))
            {
                if(GateInfo[g][gPassed])
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GREY," This gate is password protected !");
                        SendClientMessage(playerid, COLOR_WHITE," USAGE: /gate [pass]");
                        return 1;
                    }
                    if(strcmp(tmp, GateInfo[g][gPass], true) == 0)
                    {
                        if(gatedown[g] == 0)
                        {
                            if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                            MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosXM], GateInfo[g][gPosYM], GateInfo[g][gPosZM], GateInfo[g][gSpeed]);
                            gatedown[g] = 1;
                            return 1;
                        }
                        if(gatedown[g] != 0)
                        {
                            if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                            MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosX], GateInfo[g][gPosY], GateInfo[g][gPosZ], GateInfo[g][gSpeed]);
                            gatedown[g] = 0;
                            return 1;
                        }
                    }
                    else
                    {
                        return SendClientMessage(playerid, COLOR_GREY," Invalid password !");
                    }
                }
                if( (GateInfo[g][gFamily] == 255 && GateInfo[g][gFaction] == 0) ||
                    (GateInfo[g][gFamily] != 0 && PlayerInfo[playerid][pFMember]+1 == GateInfo[g][gFamily]) ||
                    (GateInfo[g][gFaction] != 0 && PlayerInfo[playerid][pMember] == GateInfo[g][gFaction]) ||
                    GateInfo[g][gHID] == PlayerInfo[playerid][pPhousekey] ||
                    PlayerInfo[playerid][pAdmin] >= 1339)
                {

                    if(gatedown[g] == 0)
                    {
                        if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                        MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosXM], GateInfo[g][gPosYM], GateInfo[g][gPosZM], GateInfo[g][gSpeed]);
                        gatedown[g] = 1;
                        return 1;
                    }
                    if(gatedown[g] == 1)
                    {
                        if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                        MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosX], GateInfo[g][gPosY], GateInfo[g][gPosZ], GateInfo[g][gSpeed]);
                        gatedown[g] = 0;
                        return 1;
                    }
                }
                else
                {
                    return SendClientMessage(playerid, COLOR_GREY," You don't have the remote for this gate !");
                }
            }
            else
            {
                if(g < MAX_GATES)
                {
                    continue;
                }
                else
                {
                    return SendClientMessage(playerid, COLOR_GREY," You're not near to any gate");
                }
            }
        }
        return 1;
    }
Reply
#2

Код:
public OnPlayerCommandText( playerid, cmdtext[] )
{
dcmd( gate, 5, cmdtext );
	return ( 0 );
}
dcmd_gate( playerid, params[] )
    {
        if(IsPlayerInRangeOfPoint(playerid,9,1588.3058,-1637.9652,13.4227))
        { //POLICE GATE
            if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SASP !");
            if(pdgategar==0)
            {
                pdgategar = 1;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 7.710285, 1.50);
                return 1;
            }
            else if(pdgategar==1)
            {
                pdgategar = 0;
                MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 15.260185, 1.50);
                return 1;
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
        { //POLICE BAR
            if(!IsACop(playerid)&& !IsAnAgent(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SAST !");
            if(pdgatebar==0)
            {
                pdgatebar = 1;
                SetObjectRot( pdbarriergateobj, 0.0000, 360.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.953003, 13.079567 );
                return 1;
            }
            else if(pdgatebar==1)
            {
                pdgatebar = 0;
                SetObjectRot( pdbarriergateobj, 0.0000, 90.0000, 90.0000);
                SetObjectPos( pdbarriergateobj, 1544.682495, -1630.980000, 13.215000 );
                return 1;
            }
        }
        if(IsPlayerInRangeOfPoint(playerid,9,1269.7087,-914.3023,42.3584))
        { //FAMILY 5 & Tye Spencer GATE
            if(PlayerInfo[playerid][pFMember] != 5)
            if(tyespencer == 0)
            {
                tyespencer = 1;
                MoveDynamicObject(tyespencergateobj, 1269.73205566,-913.85491943,36.03096771,1.50);
                return 1;
            }
            else if(tyespencer == 1)
            {
                tyespencer = 0;
                MoveDynamicObject(tyespencergateobj, 1269.50585938,-913.93554688,43.37343216,1.50);
                return 1;
            }
        }
        else if(IsPlayerInRangeOfPoint(playerid,9,96.8500, 1923.4334, 15.3518))
        { //PRISON GATE
            if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 5 && !IsAnAgent(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not a Cop / FBI / SAST / PG !");
            if(Prison_Buttons[GateOpened] == 0)
            {
                MoveDynamicObject(Prison_Buttons[PrisonGate], 96.808670, 1923.5, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 1;
                Prison_Buttons[GateTimerID]= SetTimer("PrisonGateCheck", 60000, 0);
            }
            else
            {
                MoveDynamicObject(Prison_Buttons[PrisonGate], 96.808670, 1920.512817, 16.234968, 1.50);
                Prison_Buttons[GateOpened] = 0;
                KillTimer(Prison_Buttons[GateTimerID]);
            }
        }
        for(new g=0;g<MAX_GATES;g++)
        {
            new Float:gaX, Float:gaY, Float:gaZ;
            GetDynamicObjectPos(GateInfo[g][gID], gaX, gaY, gaZ);
            if(IsPlayerInRangeOfPoint(playerid, GateInfo[g][gRange], gaX,gaY,gaZ))
            {
                if(GateInfo[g][gPassed])
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GREY," This gate is password protected !");
                        SendClientMessage(playerid, COLOR_WHITE," USAGE: /gate [pass]");
                        return 1;
                    }
                    if(strcmp(tmp, GateInfo[g][gPass], true) == 0)
                    {
                        if(gatedown[g] == 0)
                        {
                            if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                            MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosXM], GateInfo[g][gPosYM], GateInfo[g][gPosZM], GateInfo[g][gSpeed]);
                            gatedown[g] = 1;
                            return 1;
                        }
                        if(gatedown[g] != 0)
                        {
                            if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                            MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosX], GateInfo[g][gPosY], GateInfo[g][gPosZ], GateInfo[g][gSpeed]);
                            gatedown[g] = 0;
                            return 1;
                        }
                    }
                    else
                    {
                        return SendClientMessage(playerid, COLOR_GREY," Invalid password !");
                    }
                }
                if( (GateInfo[g][gFamily] == 255 && GateInfo[g][gFaction] == 0) ||
                    (GateInfo[g][gFamily] != 0 && PlayerInfo[playerid][pFMember]+1 == GateInfo[g][gFamily]) ||
                    (GateInfo[g][gFaction] != 0 && PlayerInfo[playerid][pMember] == GateInfo[g][gFaction]) ||
                    GateInfo[g][gHID] == PlayerInfo[playerid][pPhousekey] ||
                    PlayerInfo[playerid][pAdmin] >= 1339)
                {

                    if(gatedown[g] == 0)
                    {
                        if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                        MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosXM], GateInfo[g][gPosYM], GateInfo[g][gPosZM], GateInfo[g][gSpeed]);
                        gatedown[g] = 1;
                        return 1;
                    }
                    if(gatedown[g] == 1)
                    {
                        if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
                        MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosX], GateInfo[g][gPosY], GateInfo[g][gPosZ], GateInfo[g][gSpeed]);
                        gatedown[g] = 0;
                        return 1;
                    }
                }
                else
                {
                    return SendClientMessage(playerid, COLOR_GREY," You don't have the remote for this gate !");
                }
            }
            else
            {
                if(g < MAX_GATES)
                {
                    continue;
                }
                else
                {
                    return SendClientMessage(playerid, COLOR_GREY," You're not near to any gate");
                }
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)