Moveable Gates
#1

How to make gate editing easy? Than i can with mouse chose open and close possition.

Like it is in Liberty City RolePlay.

PHP код:
    if(strcmp(cmd"/editgate"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] < 1339)
        {
            return 
SendClientMessage(playeridCOLOR_GREY," You're not authorized to use that command !");
        }
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playerid,COLOR_GREY," USAGE: /editgate [gate id] [name]");
            
SendClientMessage(playerid,COLOR_GREY," Available names : location, family, faction");
            return 
1;
        }
        new 
gateid strvalEx(tmp);
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playerid,COLOR_GREY," USAGE: /editgate [gate id] [name]");
            
SendClientMessage(playerid,COLOR_GREY," Available names : location, family, faction");
            return 
1;
        }
        if(
strcmp(tmp"location"true) == 0)
        {
            if(
gateid >= && gateid MAX_GATES)
            {
                new 
Float:playaXFloat:playaYFloat:playaZFloat:playaA;
                
GetPlayerPos(playeridplayaXplayaYplayaZ);
                
GetPlayerFacingAngle(playeridplayaA);
                
GateInfo[gateid][gX] = playaX;
                
GateInfo[gateid][gY] = playaY;
                
GateInfo[gateid][gZ] = playaZ;
                
GateInfo[gateid][gRot] = playaA;
                
DestroyDynamicObject(GateInfo[gateid][gID]);
                
GateInfo[gateid][gID] = CreateDynamicObject(980GateInfo[gateid][gX], GateInfo[gateid][gY], GateInfo[gateid][gZ]+1.750.0,0.0playaA);
                new 
locstr[256];
                
format(locstr,sizeof(locstr)," Changed location for gate ID %d !"gateid);
                
SendClientMessage(playeridCOLOR_GREYlocstr);
                
SaveGates();
                return 
1;
            }
            else
            {
                return 
SendClientMessage(playeridCOLOR_GREY"Invalid gate ID !");
            }
        }
        else if(
strcmp(tmp"family"true) == 0)
        {
            
tmp strtok(cmdtextidx);
            if(!
strval(tmp))
            {
                return 
SendClientMessage(playeridCOLOR_GREY," USAGE: /editgate [gateid] family [familyid]");
            }
            new 
dingdingdong strvalEx(tmp);
            if(
gateid >= && gateid MAX_GATES)
            {
                if(
dingdingdong || dingdingdong 14)
                {
                    return 
SendClientMessage(playeridCOLOR_GREY," Valid family IDs : 1-14 ");
                }
                
GateInfo[gateid][gFamily] = dingdingdong-1;
                new 
famstr[256];
                
format(famstr,sizeof(famstr)," Gave family %d permissions to gate %d."dingdingdonggateid);
                
SendClientMessage(playeridCOLOR_GREYfamstr);
                
SaveGates();
                return 
1;
            }
            else
            {
                return 
SendClientMessage(playeridCOLOR_GREY"Invalid gate ID !");
            }
        }
        else if(
strcmp(tmp"faction"true) == 0)
        {
            
tmp strtok(cmdtextidx);
            if(!
strval(tmp))
            {
                return 
SendClientMessage(playeridCOLOR_GREY," USAGE: /editgate [gateid] faction [familyid]");
            }
            new 
dingdingdong strvalEx(tmp);
            if(
gateid >= && gateid MAX_GATES)
            {
                if(
dingdingdong || dingdingdong 10)
                {
                    return 
SendClientMessage(playeridCOLOR_GREY," Valid faction IDs : 1-10 ");
                }
                
GateInfo[gateid][gFaction] = dingdingdong;
                new 
facstr[256];
                
format(facstr,sizeof(facstr)," Gave faction %d permissions to gate %d."dingdingdonggateid);
                
SendClientMessage(playeridCOLOR_GREYfacstr);
                
SaveGates();
                return 
1;
            }
            else
            {
                return 
SendClientMessage(playeridCOLOR_GREY"Invalid gate ID !");
            }
        }
        return 
1;
    } 
PHP код:
    if(strcmp(cmd"/creategate"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1339)
        {
            new    
Float:ppX,
                
Float:ppY,
                
Float:ppZ;
            
tmp strtok(cmdtextidx);
               if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GREY"USAGE: /creategate [name] [value]");
                
SendClientMessage(playeridCOLOR_GREY"Available names: location, locationm(opened), complete");
                return 
1;
            }
            if(
strcmp(tmp"location"true) == 0)
            {
                
GetPlayerPos(playeridppXppYppZ);
                
ggX[playerid] = ppXggY[playerid] = ppYggZ[playerid] = ppZ;
                
SendClientMessage(playeridCOLOR_GREY," Coordinates saved for gate location !");
                return 
1;
            }
            else if(
strcmp(tmp"complete"true) == 0)
            {
                for(new 
g=0;g<MAX_GATES;g++)
                {
                    if(
GateInfo[g][gPosX] == 0.0)
                    {
                        if(
ggX[playerid] != 0.0)
                        {
                            if(
ggXM[playerid] != 0.0)
                            {
                                
GateInfo[g][gPosX] = ggX[playerid];
                                
GateInfo[g][gPosY] = ggY[playerid];
                                
GateInfo[g][gPosZ] = ggZ[playerid]+1.7;
                                
GateInfo[g][gPosXM] = ggXM[playerid];
                                
GateInfo[g][gPosYM] = ggYM[playerid];
                                
GateInfo[g][gPosZM] = ggZM[playerid];
                                
GateInfo[g][gModel] = 980;
                                
GateInfo[g][gRange] = 10;
                                
GateInfo[g][gSpeed] = 3;
                                
strmid(GateInfo[g][gPass],""0023);
                                
GateInfo[g][gPassed] = 0;
                                
CreateGate(g);
                                
//GateInfo[g][gID] = CreateDynamicObject(980, ggX[playerid], ggY[playerid], ggZ[playerid]+1.75, 0.0,0.0, 0.0);
                                
new gatestr[256];
                                
format(gatestr,sizeof(gatestr)," Gate ID %d created successfully ! Use /editgate to personalise it."g);
                                  
SendClientMessage(playeridCOLOR_GREY,gatestr);
                                
SaveGates();
                                return 
1;
                            }
                            else
                            {
                                return 
SendClientMessage(playeridCOLOR_GREY," You haven't defined the open gate position ! ( /creategate locationm )");
                            }
                        }
                        else
                        {
                            return 
SendClientMessage(playeridCOLOR_GREY," You haven't defined the gate position ! ( /creategate location )");
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            else if(
strcmp(tmp"locationm"true) == 0)
            {
                
GetPlayerPos(playeridppXppYppZ);
                
ggXM[playerid] = ppXggYM[playerid] = ppYggZM[playerid] = ppZ;
                
SendClientMessage(playeridCOLOR_GREY," Coordinates saved for opened gate location !");
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"USAGE: /creategate [name]");
                
SendClientMessage(playeridCOLOR_GREY"Available names: location, complete");
                return 
1;
            }
        }
        else
        {
      
SendClientMessage(playeridCOLOR_GRAD2"You are not authorized to use that command!");
            return 
1;
        }
        return 
1;
    } 
Reply
#2

Easy? I would say this system is already more than easy.
Reply
#3

I mean that i dont need put Coordinates to gates would be in that place what i want but do it with mouse, like Liberty City RP.

PHP код:
    if(strcmp(cmd"/editgate"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1339)
        {
            new 
gateidFloat:ofloat;
            
tmp strtok(cmdtextidx); // x_job, gateid, ofloat
            
if(!strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, gate");
                return 
1;
            }
            if(
strcmp(tmp"hid"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                
ofloat floatstr(tmp);
                new 
value floatround(ofloatfloatround_round);
                if(
value MAX_HOUSES) return SendClientMessage(playeridCOLOR_WHITE"* Invalid House ID!");
                
GateInfo[gateid][gHID] = value;
                
format(stringsizeof(string), "Gate HID assigned to %d"GateInfo[gateid][gHID]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"model"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
value floatround(ofloatfloatround_round);
                if(
value == 0)
                {
                    
GateInfo[gateid][gPosX] = 0.0;
                    
GateInfo[gateid][gPosY] = 0.0;
                    
GateInfo[gateid][gPosZ] = 0.0;
                    
GateInfo[gateid][gRotX] = 0.0;
                    
GateInfo[gateid][gRotY] = 0.0;
                    
GateInfo[gateid][gRotZ] = 0.0;
                    
GateInfo[gateid][gPosXM] = 0.0;
                    
GateInfo[gateid][gPosYM] = 0.0;
                    
GateInfo[gateid][gPosZM] = 0.0;
                    
GateInfo[gateid][gRotXM] = 0.0;
                    
GateInfo[gateid][gRotYM] = 0.0;
                    
GateInfo[gateid][gRotZM] = 0.0;
                }
                
GateInfo[gateid][gModel] = value;
                
format(stringsizeof(string), "Gate Model assigned to %d"GateInfo[gateid][gModel]);
                
CreateGate(gateid);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"range"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
value floatround(ofloatfloatround_round);
                
GateInfo[gateid][gRange] = value;
                
format(stringsizeof(string), "Gate Range assigned to %d"GateInfo[gateid][gRange]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"speed"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
value floatround(ofloatfloatround_round);
                
GateInfo[gateid][gSpeed] = value;
                
format(stringsizeof(string), "Gate Speed assigned to %d"GateInfo[gateid][gSpeed]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"posx"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gPosX] = value;
                
format(stringsizeof(string), "Gate PosX assigned to %f"GateInfo[gateid][gPosX]);
                
SetDynamicObjectPos(GateInfo[gateid][gID], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"posy"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gPosY] = value;
                
format(stringsizeof(string), "Gate PosY assigned to %f"GateInfo[gateid][gPosY]);
                
SetDynamicObjectPos(GateInfo[gateid][gID], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"posz"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gPosZ] = value+1.7;
                
format(stringsizeof(string), "Gate PosZ assigned to %f"GateInfo[gateid][gPosZ]);
                
SetDynamicObjectPos(GateInfo[gateid][gID], GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"posxm"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gPosXM] = value;
                
format(stringsizeof(string), "Gate PosXM assigned to %f"GateInfo[gateid][gPosXM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
CreateGate(gateid);
                
SaveGates();
            }
            else if(
strcmp(tmp"posym"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gPosYM] = value;
                
format(stringsizeof(string), "Gate PosYM assigned to %f"GateInfo[gateid][gPosYM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
CreateGate(gateid);
                
SaveGates();
            }
            else if(
strcmp(tmp"poszm"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gPosZM] = value;
                
format(stringsizeof(string), "Gate PosZM assigned to %f"GateInfo[gateid][gPosZM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
CreateGate(gateid);
                
SaveGates();
            }
            else if(
strcmp(tmp"rotx"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gRotX] = value;
                
format(stringsizeof(string), "Gate RotX assigned to %f"GateInfo[gateid][gRotX]);
                
SetDynamicObjectRot(GateInfo[gateid][gID], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"roty"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gRotY] = value;
                
format(stringsizeof(string), "Gate RotY assigned to %f"GateInfo[gateid][gRotY]);
                
SetDynamicObjectRot(GateInfo[gateid][gID], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"rotz"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gRotZ] = value;
                
format(stringsizeof(string), "Gate RotZ assigned to %f"GateInfo[gateid][gRotZ]);
                
SetDynamicObjectRot(GateInfo[gateid][gID], GateInfo[gateid][gRotX],GateInfo[gateid][gRotY],GateInfo[gateid][gRotZ]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"rotxm"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gRotXM] = value;
                
format(stringsizeof(string), "Gate RotXM assigned to %f"GateInfo[gateid][gRotXM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"rotym"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gRotYM] = value;
                
format(stringsizeof(string), "Gate RotYM assigned to %f"GateInfo[gateid][gRotYM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"rotzm"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
ofloat floatstr(tmp);
                new 
Float:value ofloat;
                
GateInfo[gateid][gRotZM] = value;
                
format(stringsizeof(string), "Gate RotZM assigned to %f"GateInfo[gateid][gRotZM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SaveGates();
            }
            else if(
strcmp(tmp"tome"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate tome [gateid]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
GetPlayerPos(playerid,GateInfo[gateid][gPosX],GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]);
                
GateInfo[gateid][gPosZ] += 1.7;
                
format(stringsizeof(string), "Gate Pos moved to %f %f %f"GateInfo[gateid][gPosX], GateInfo[gateid][gPosY], GateInfo[gateid][gPosZ]+1.7);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                if(
GateInfo[gateid][gModel] == 0)
                {
                    
GateInfo[gateid][gModel] = 980;
                    
GateInfo[gateid][gRange] = 10;
                    
GateInfo[gateid][gSpeed] = 5;
                }
                
//if(IsValidDynamicObject(GateInfo[gateid][gID])) DestroyDynamicObject(GateInfo[gateid][gID]);
                
CreateGate(gateid);
                
SaveGates();
            }
            else if(
strcmp(tmp"tomem"true) == 0)
            {
                
tmp strtok(cmdtextidx);
                
gateid strvalEx(tmp);
                if(
gateid || gateid >= MAX_GATES)
                {
                    
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate tomem [gateid]]");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, VW, Int, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                    
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, status, gate, renderhq");
                    return 
1;
                }
                
GetPlayerPos(playerid,GateInfo[gateid][gPosXM],GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
                
format(stringsizeof(string), "Gate PosM moved to %f %f %f"GateInfo[gateid][gPosXM], GateInfo[gateid][gPosYM], GateInfo[gateid][gPosZM]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
CreateGate(gateid);
                
SaveGates();
            }
            else
            {
                
SendClientMessage(playeridCOLOR_WHITE"USAGE: /editgate [name] [gateid] [value]");
                
SendClientMessage(playeridCOLOR_GREY"Available names: HID, Model, PosX(M), PosY(M), PosZ(M), RotX(M), RotZ(M)");
                
SendClientMessage(playeridCOLOR_GREY"Available names: tome(m), range, speed, gate");
                return 
1;
            }
        }
        else
        {
      
SendClientMessage(playeridCOLOR_GRAD2"You are not authorized to use that command!");
            return 
1;
        }
        return 
1;
    } 
This is the real /editgate command, sorry. Want to make it easier to place gates editing them with mouse.
Reply
#4

I think the LC:RP script is available for download, so why dont you do it and learn from it?
Reply
#5

Because it's hard to change the code to that can compile to my GM.

Here is code from LC:RP
PHP код:
CMD:creategate(playeridparams[])
{
    new 
string[128], object;
       if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
aDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You are not on admin duty.");
    if(
sscanf(params"i"object)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /creategate [objectid]");
    for(new 
idx=1idx<MAX_GATESidx++)
    {
        if(!
GateInfo[idx][gModel])
        {
            
GetPlayerPos(playeridGateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]);
              
GateInfo[idx][gModel] = object;
            
GateInfo[idx][gCX] = GateInfo[idx][gCX] + 2;
            
GateInfo[idx][gCY] = GateInfo[idx][gCY] + 2;
            
GateInfo[idx][gCRX] = 0;
            
GateInfo[idx][gCRY] = 0;
            
GateInfo[idx][gCRZ] = 0;
            
GetPlayerPos(playeridGateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]);
            
GateInfo[idx][gOX] = GateInfo[idx][gOX] + 2;
            
GateInfo[idx][gOY] = GateInfo[idx][gOY] + 2;
            
GateInfo[idx][gORX] = 0;
            
GateInfo[idx][gORY] = 0;
            
GateInfo[idx][gORZ] = 0;
            
GateInfo[idx][gStatus] = 0;
            
format(GateInfo[idx][gPassword], 256"");
            
GateInfo[idx][gSpeed] = 2;
            
// Creating
            
format(stringsizeof(string), "Gate ID: %d"idx);
            
GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
            
GateInfo[idx][gText] = CreateDynamic3DTextLabel(stringCOLOR_WHITEGateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], 10);
            
// Text
            
format(stringsizeof(string), "AdmWarn: %s has created gate ID %d. (Object: %d)"RPN(playerid), idxobject);
            
SendAdminMessage(COLOR_DARKRED1string);
            
Log("logs/gates.log"string);
            
idx MAX_GATES;
        }
    }
    return 
1;

PHP код:
CMD:gedit(playeridparams[])
{
    new 
string[128], idx;
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
aDuty[playerid]) return SendClientMessage(playeridCOLOR_GREY"You are not on admin duty.");
     if(
sscanf(params"s[128]"params))
    {
        
SendClientMessage(playeridCOLOR_WHITE"USAGE: /gedit [option] [gateid]");
        
SendClientMessage(playeridCOLOR_GREY"OPTIONS: object | close | open | speed | password");
        return 
1;
    }
    if(!
strcmp(params"object"true5))
    {
        new 
object;
        if(
sscanf(params"s[128]ii"paramsidxobject)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /gedit object [gateid] [objectid]");
        if(!
GateInfo[idx][gModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid gate id.");
        if(
object == 0)
        {
            
format(stringsizeof(string), "%d"object);
            
cmd_deletegate(playeridstring);
            return 
1;
        }
        
GateInfo[idx][gModel] = object;
        
DestroyDynamicObject(GateInfo[idx][gGate]);
        
GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
        
format(stringsizeof(string), " You have set gate ID %d's object ID to %d."idxobject);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    else if(!
strcmp(params"close"true5))
    {
        if(
sscanf(params"s[128]i"paramsidx)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /gedit position [gateid]");
        if(!
GateInfo[idx][gModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid gate id.");
        
gEdit[playerid] = 1;
        
gEditID[playerid] = idx;
        
GetDynamicObjectPos(GateInfo[idx][gGate], gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
        
GetDynamicObjectRot(GateInfo[idx][gGate], gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]);
        
EditDynamicObject(playeridGateInfo[idx][gGate]);
        
format(stringsizeof(string), " You are now editing gate ID %d's closing position."idx);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    else if(!
strcmp(params"open"true4))
    {
        if(
sscanf(params"s[128]i"paramsidx)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /gedit open [gateid]");
        if(!
GateInfo[idx][gModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid gate id.");
        
gEdit[playerid] = 2;
        
gEditID[playerid] = idx;
        
GetDynamicObjectPos(GateInfo[idx][gGate], gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
        
GetDynamicObjectRot(GateInfo[idx][gGate], gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]);
        
EditDynamicObject(playeridGateInfo[idx][gGate]);
        
format(stringsizeof(string), " You are now editing gate ID %d's opening position."idx);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    else if(!
strcmp(params"speed"true5))
    {
        new 
Float:speed;
        if(
sscanf(params"s[128]if"paramsidxspeed)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /gedit open [gateid] [speed]");
        if(!
GateInfo[idx][gModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid gate id.");
        
GateInfo[idx][gSpeed] = speed;
        
format(stringsizeof(string), " You have set gate ID %d's moving speed to %f."idxspeed);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    else if(!
strcmp(params"password"true8))
    {
        new 
password[256];
        if(
sscanf(params"s[128]is[256]"paramsidxpassword)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /gedit open [gateid] [password]");
        if(!
GateInfo[idx][gModel]) return SendClientMessage(playeridCOLOR_GREY"Invalid gate id.");
        
format(GateInfo[idx][gPassword], 256"%s"password);
        
format(stringsizeof(string), " You have set gate ID %d's password to {FF6347}%s"idxpassword);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)