Es gibt bestimmt bessere varianten aber
ich habs so gemacht:
globale Variable:
new Schranken;
OnGameModeInit:
LoadSchranken();
Command:
ocmd:schranken(playerid,params[])
{
if(Schranken == 1)
{
CloseAllSchranken();
}
else
if(Schranken == 0)
{
OpenAllSchranken();
}
return 1;
}
Stocks:
stock OpenAllSchranken()
{
MoveDynamicObjectRot(schranke[0],0,0,0,true);
MoveDynamicObjectRot(schranke[1],0,0,0,true);
MoveDynamicObjectRot(schranke[2],0,0,0,true);
MoveDynamicObjectRot(schranke[3],0,0,0,true);
MoveDynamicObjectRot(schranke[4],0,0,0,true);
MoveDynamicObjectRot(schranke[5],0,0,0,true);
MoveDynamicObjectRot(schranke[6],0,0,0,true);
MoveDynamicObjectRot(schranke[7],0,0,0,true);
MoveDynamicObjectRot(schranke[8],0,0,0,true);
MoveDynamicObjectRot(schranke[9],0,0,0,true);
Schranken = 1;
return 1;
}
stock CloseAllSchranken()
{
MoveDynamicObjectRot(schranke[0],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[1],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[2],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[3],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[4],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[5],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[6],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[7],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[8],0,90.0000,0,true);
MoveDynamicObjectRot(schranke[9],0,90.0000,0,true);
Schranken = 0;
return 1;
}
stock LoadSchranken()
{
print("Schranken werden Geladen.");
schranke[0] = CreateDynamicObject(968, 190.0970, -141.1317, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[1] = CreateDynamicObject(968, 198.2671, -141.1317, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[2] = CreateDynamicObject(968, 206.1571, -141.1317, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[3] = CreateDynamicObject(968, 213.9771, -141.1317, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[4] = CreateDynamicObject(968, 221.6571, -141.1317, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[5] = CreateDynamicObject(968, 190.0970, -144.0717, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[6] = CreateDynamicObject(968, 198.2371, -144.0717, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[7] = CreateDynamicObject(968, 205.9669, -144.0717, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[8] = CreateDynamicObject(968, 213.7969, -144.0717, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
schranke[9] = CreateDynamicObject(968, 221.5068, -144.0717, 1.0950, 0.0000, 90.0000, 0.0000); //barrierturn
print("Schranken wurden Geladen.");
Schranken = 0;
return 1;
}