Jump to content
  • 0

pomoc Brany sa neotvaraju


DJ_Oli22

Dotaz

Zdravim

Mam problem ze ked zatrubim napriklad pred letiskom v lv a som pilot tak sa mi brana neotvori..

P.S.: ked som policajt a zatrubim pred branou ktora je v ls na stanici tak ta sa otvori ale zrejme je to tym ze je ako prva v poradi.

mam spravenych takto asi 10 brán a su pomenovane Cela[0], Cela[1] .... a funguje to len s celou [0]

 

//EDIT: fungujú všetky "cely" pri povolani policajt cize potom tie ostatne nefunguju :/

 

 

pls help, Dakujem

Kod:

 

niekde na zaciatku

new Cela[15] // 15 lebo 5 je este takych statickych 

OnGameModeInit

	Cela[0] = CreateObject(980, 1587.8, -1638.2431, 15.1059, 0.0, 0.0, -180.0, 0);
	Cela[1] = CreateObject(980, 2334.788, 2443.458, 7.491, 0.0, 0.0, 56.25, 0);
	Cela[2] = CreateObject(972, -1629.387, 685.453, 3.9839, 0.0, 0.0, -270.0, 0);
	Cela[3] = CreateObject(980, 1961.5999, -2189.8589, 15.3199, 0.0, 0.0, 0.0, 0);
	Cela[4] = CreateObject(980, -1545.475, -430.4921, 7.762, 0.0, 0.0, 135.0, 0);
	Cela[5] = CreateObject(980, 1705.9499, 1607.592, 11.864, 0.0, 0.859, 73.593, 0);
	Cela[6] = CreateObject(975, 2720.3359, -2405.327, 13.661, 0.0, 0.0, -90.0, 0);
	Cela[7] = CreateObject(980, -1528.9351, 482.242, 8.953, 0.0, 0.0, 0.0, 0);
	Cela[8] = CreateObject(980, 2294.1259, 2498.3569, 5.0469, 0.0, 0.0, -90.0, 0);
	Cela[9] = CreateObject(975, 2720.3811, -2504.054, 13.6649, 0.0, 0.0, 90.0, 0);
	Cela[10] = CreateObject(985, -1228.985, 58.159, 14.8409, 0.0, 0.0, 45.0, 0);
	Cela[11] = CreateObject(985, -1218.016, 69.138, 14.8409, 0.0, 0.0, -135.0, 0);
	Cela[12] = CreateObject(971, 96.708, 1922.9389, 20.645, 0.0, 0.0, -90.8591, 0);
	Cela[13] = CreateObject(976, 218.5489, 1875.5119, 12.309, 0.0, 0.0, -180.0, 0);
	Cela[14] = CreateObject(980, 248.5549, 1802.6109, 9.0909, 0.0, 0.0, 0.0, 0);

OnKeyStateChange

if(newkeys == 2){
if(GetPlayerJob(playerid) == POLICIA1 || GetPlayerJob(playerid) == POLICIA2 || GetPlayerJob(playerid) == POLICIA3){
if(IsPlayerInRangeOfPoint(playerid,30,1587.8, -1638.2431, 9.5889)){
if(Objekty[0] == 0){
MoveObject(Cela[0], 1587.8, -1638.2431, 9.5889, 2.0);
Objekty[0] = 1;
}else{
MoveObject(Cela[0], 1587.8, -1638.2431, 15.1059, 2.0);
Objekty[0] = 0;
}
}
else if(IsPlayerInRangeOfPoint(playerid,30, 2334.788, 2443.458, 1.972) || IsPlayerInRangeOfPoint(playerid,30,2294.1259, 2498.3569, -0.5031)){
if(!Objekty[1]){
MoveObject(Cela[1], 2334.788, 2443.458, 1.972, 2.0);
MoveObject(Cela[8], 2294.1259, 2498.3569, -0.5031, 2.0);
Objekty[1] = 1;
}else{
MoveObject(Cela[1], 2334.788, 2443.458, 7.491, 2.0);
MoveObject(Cela[8], 2294.1259, 2498.3569, 5.0469, 2.0);
Objekty[1] = 0;
}
}
else if(IsPlayerInRangeOfPoint(playerid,30, -1629.387, 685.453, -1.091)){
if(!Objekty[2])
{
MoveObject(Cela[2], -1629.387, 685.453, -1.091, 2.0);
Objekty[2] = 1;
}else{
MoveObject(Cela[2], -1629.387, 685.453, 3.9839, 2.0);
Objekty[2] = 0;
}
}
else if(GetPlayerJob(playerid) == PILOT1 || GetPlayerJob(playerid) == PILOT2 || GetPlayerJob(playerid) == PILOT3){
if(IsPlayerInRangeOfPoint(playerid,30, 1961.5999, -2189.8589, 9.77)){
if(!Objekty[3]){
MoveObject(Cela[3], 1961.5999, -2189.8589, 9.77, 2.0);
Objekty[3] = 1;
}else{
MoveObject(Cela[3], 1961.5999, -2189.8589, 15.3199, 2.0);
Objekty[3] = 0;
}}
else if(IsPlayerInRangeOfPoint(playerid, 30, -1545.475, -430.4921, 7.762) || IsPlayerInRangeOfPoint(playerid, 30, -1228.985, 58.159, 14.8409) || IsPlayerInRangeOfPoint(playerid, 30, -1218.016, 69.138, 14.8409)){
if(!Objekty[4])
{
MoveObject(Cela[4], -1545.475, -430.4921, 2.2449, 2.0);
MoveObject(Cela[10], -1228.985, 58.159, 7.6129, 2.0);
MoveObject(Cela[11], -1218.016, 69.138, 7.6129, 2.0);
Objekty[4] = 1;
}else{
MoveObject(Cela[4], -1545.475, -430.4921, 7.762, 2.0);
MoveObject(Cela[10], -1228.985, 58.159, 14.8409, 2.0);
MoveObject(Cela[11], -1218.016, 69.138, 14.8409, 2.0);
Objekty[4] = 0;
}}
else if(IsPlayerInRangeOfPoint(playerid,30, 1705.9499, 1607.592, 6.3579)){
if(Objekty[5] == 0){
MoveObject(Cela[5], 1705.9499, 1607.592, 6.3579, 2.0);
Objekty[5] = 1;
}else{
MoveObject(Cela[5], 1705.9499, 1607.592, 11.864, 2.0);
Objekty[5] = 0;
}}
}
Link to comment
Share on other sites

5 odpovědí na tuto otázku

Recommended Posts

  • 0

Spočítaj si zátvorky...

 

Pred

else if(GetPlayerJob(playerid) == PILOT1 || GetPlayerJob(playerid) == PILOT2 || GetPlayerJob(playerid) == PILOT3){

ti chýba

}
Link to comment
Share on other sites

  • 0

No ale ziadny error mi to nehadze a ked tam tu zavorku dam tak mi hodi

 

 error 010: invalid function or declaration

a to mi hodi na posledny return 1..

 

Ja riešim to, prečo ti to funguje len u policajta...

 

A je to preto, že máš podmienku "ak je policajt" a v nej máš druhu podmienku "ak je pilot" preto ti to za pilota nefunguje....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...