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


Messages In This Thread
Moveable Gates - by FaZeRs - 10.02.2013, 16:51
Re: Moveable Gates - by batonsa - 10.02.2013, 16:53
Re: Moveable Gates - by FaZeRs - 10.02.2013, 16:56
Re: Moveable Gates - by batonsa - 10.02.2013, 17:47
Re: Moveable Gates - by FaZeRs - 10.02.2013, 18:37

Forum Jump:


Users browsing this thread: 1 Guest(s)