PDA

View Full Version : Need a little help with something please.


moadi
30/09/2011, 11:39 AM
Hey there ,

I've been trying to script an elevator , everything is working fine till now except one thing :


//=================ELEUP==========================
if (strcmp("/eleup", cmdtext, true, 10) == 0){

MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("ele", 8000, 0);

}

//====================ELECDOWN====================== ====
if (strcmp("/eledown", cmdtext, true, 10) == 0){
MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("eledown", 4000, 0);
}

//=================================================
public ele()
{
MoveObject(object2,1213.5999755859, -1668.1999511719, 29.10000038147, 3.00);
return 1;
}
//=================================================
public eledown()
{
MoveObject(object2,1222.3000488281, -1668.0999755859, 12.5, 3.00);
return 1;
}

//I've done this timer thingy because the elevator doesn't go straight up , moves left and right aswell ..



It's all working fine but how can i make it that if the elevator is moving up the player won't be able to use /eledown until the elevator reaches it up.

Thanks in advance .

Raimis_R
30/09/2011, 11:48 AM
new bool:EleOrder[MAX_PLAYERS];

//=================ELEUP==========================
if (strcmp("/eleup", cmdtext, true, 6) == 0)
{
MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("ele", 8000, 0);
return 1;
}

//====================ELECDOWN====================== ====
if (strcmp("/eledown", cmdtext, true, 8) == 0)
{
if (EleOrder[playerid])return 0;

MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("eledown", 4000, 0);
EleOrder[playerid] = true;
return 1;
}

//=================================================
public ele()
{
MoveObject(object2,1213.5999755859, -1668.1999511719, 29.10000038147, 3.00);
return 1;
}
//=================================================
public eledown()
{
MoveObject(object2,1222.3000488281, -1668.0999755859, 12.5, 3.00);
EleOrder[playerid] = false;
return 1;
}

Jafet_Macario
30/09/2011, 11:50 AM
new bool: elevator; // TOP
//=================ELEUP==========================
if (strcmp("/eleup", cmdtext, true, 10) == 0){

MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("ele", 8000, 0);
elevator = true;

}

//====================ELECDOWN====================== ====
if (strcmp("/eledown", cmdtext, true, 10) == 0)
{
if(elevator == true) return SendClientMessage(playerid, -1,"The elevator is moving up, you can't use /eledown");
MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("eledown", 4000, 0);
}

//=================================================
public ele()
{
MoveObject(object2,1213.5999755859, -1668.1999511719, 29.10000038147, 3.00);
elevator = false;
return 1;
}
//=================================================
public eledown()
{
MoveObject(object2,1222.3000488281, -1668.0999755859, 12.5, 3.00);
return 1;
}

moadi
30/09/2011, 11:50 AM
Works , thanks .

moadi
30/09/2011, 12:02 PM
new bool:EleOrder[MAX_PLAYERS];

//=================ELEUP==========================
if (strcmp("/eleup", cmdtext, true, 6) == 0)
{
MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("ele", 8000, 0);
return 1;
}

//====================ELECDOWN====================== ====
if (strcmp("/eledown", cmdtext, true, 8) == 0)
{
if (EleOrder[playerid])return 0;

MoveObject(object2,1222.9000244141, -1667, 29.10000038147, 2.00);
SetTimer("eledown", 4000, 0);
EleOrder[playerid] = true;
return 1;
}

//=================================================
public ele()
{
MoveObject(object2,1213.5999755859, -1668.1999511719, 29.10000038147, 3.00);
return 1;
}
//=================================================
public eledown()
{
MoveObject(object2,1222.3000488281, -1668.0999755859, 12.5, 3.00);
EleOrder[playerid] = false; // the line with the error
return 1;
}


I actually got this error
(163) error 017 undefined symbol "playerid"

Jafet_Macario
30/09/2011, 12:07 PM
Try mine.

moadi
30/09/2011, 12:09 PM
Try mine.

Just did , works perfectly , thanks :) .