20170206148636277144832.png
下面是围栏的创建,写入main()或者OnGameModeInit()函数即可;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CreateObject(966, 1209.32813, -1384.90000, 12.24180,   0.00000, 0.00000, 0.00000);//障碍底座
CreateObject(967, 1210.39294, -1384.90000, 12.24560, 0.00000, 0.00000, -90.00000);//看守台
CreateObject(970, 1187.95776, -1384.87561, 12.78820, 0.00000, 0.00000, 0.00000);//前面大门围栏
CreateObject(970, 1200.26697, -1384.90002, 12.78820, 0.00000, 0.00000, 0.00000);//前面大门围栏
CreateObject(970, 1192.11816, -1384.90002, 12.78820, 0.00000, 0.00000, 0.00000);//前面大门围栏
CreateObject(970, 1196.20007, -1384.90002, 12.78820, 0.00000, 0.00000, 0.00000);//前面大门围栏
CreateObject(1411, 1210.96069, -1383.11963, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1377.84949, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1372.57935, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1367.30921, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1362.03907, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1356.76893, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1351.49879, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1346.22865, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1340.95851, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1335.68837, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1330.41823, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1325.14809, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1319.87795, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1314.60781, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1309.33767, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1304.06753, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1298.79739, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(1411, 1210.96069, -1293.52725, 13.86000, 0.00000, 0.00000, 90.00000);//侧面围栏
CreateObject(978, 1206.48462, -1290.66870, 13.21470, 0.00000, 0.00000, 0.00000);//后面障碍
CreateObject(978, 1197.15100, -1290.66504, 13.21470, 0.00000, 0.00000, 0.00000);//后面障碍
CreateObject(978, 1187.76526, -1290.66870, 13.21470, 0.00000, 0.00000, 0.00000);//后面障碍

新建障碍门变量:

1
2
new hospitalgate1;//门关
new hospitalgate2;//门开

1
2
//写入OnGameModeInit()函数
hospitalgate1 = CreateObject(968, 1209.4478, -1384.9000, 13.0276, 0.00000, -90.00000, 0.00000);
1
2
3
4
5
6
7
public GateCloseHspt()
{
DestroyObject( hospitalgate2 );
hospitalgate1 = CreateObject(968, 1209.4478, -1384.9000, 13.0276, 0.00000, -90.00000, 0.00000);
lshospital = 0;
return 1;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//此段代码在输入指令/go(开门的指令)相关代码里面加入
else if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)//医院
{
if (IsPlayerInRangeOfPoint(playerid, 15,1209.4478,-1384.9000,12.9476))
{
if(lshospital == 1) { SendClientMessage(playerid, COLOR_GREY, "** 医院大门已经打开了"); return 1; }
DestroyObject( hospitalgate1 );
hospitalgate2 = CreateObject(968, 1209.4478, -1384.9000, 13.0276, 0.00000, 0.00000, 0.00000);
//MoveObject(hospitalgate1,1209.44775,-1385.21558,12.94760,2,0.00000,0.00000,0.0000);
SetTimer("GateCloseHspt", 6000, 0);
SendClientMessage(playerid, COLOR_BLUE,"医院门打开了并将在6秒后关闭.");

format(string, sizeof(string), "* %s 打开了 医院大门.", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
lshospital = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY,"* 你附近没有可以打开的门!.");
return 1;
}
}