SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/09/2011, 11:39 AM   #1
moadi
Big Clucker
 
Join Date: Sep 2011
Posts: 114
Reputation: -1
Default Need a little help with something please.

Hey there ,

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

Code:
//=================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 .
moadi is offline   Reply With Quote
Old 30/09/2011, 11:48 AM   #2
Raimis_R
Huge Clucker
 
Raimis_R's Avatar
 
Join Date: Nov 2010
Location: Lithuania
Posts: 398
Reputation: 15
Default Re: Need a little help with something please.

pawn Code:
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;
}
Raimis_R is offline   Reply With Quote
Old 30/09/2011, 11:50 AM   #3
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 439
Reputation: 67
Default Re: Need a little help with something please.

pawn Code:
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;
}
__________________
Jafet_Macario is offline   Reply With Quote
Old 30/09/2011, 11:50 AM   #4
moadi
Big Clucker
 
Join Date: Sep 2011
Posts: 114
Reputation: -1
Default Re: Need a little help with something please.

Works , thanks .
moadi is offline   Reply With Quote
Old 30/09/2011, 12:02 PM   #5
moadi
Big Clucker
 
Join Date: Sep 2011
Posts: 114
Reputation: -1
Default Re: Need a little help with something please.

Quote:
Originally Posted by Raimis_R View Post
pawn Code:
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
Code:
(163) error 017 undefined symbol "playerid"
moadi is offline   Reply With Quote
Old 30/09/2011, 12:07 PM   #6
Jafet_Macario
Huge Clucker
 
Jafet_Macario's Avatar
 
Join Date: Jul 2011
Posts: 439
Reputation: 67
Default Re: Need a little help with something please.

Try mine.
__________________
Jafet_Macario is offline   Reply With Quote
Old 30/09/2011, 12:09 PM   #7
moadi
Big Clucker
 
Join Date: Sep 2011
Posts: 114
Reputation: -1
Default Re: Need a little help with something please.

Quote:
Originally Posted by Jafet_Macario View Post
Try mine.
Just did , works perfectly , thanks .
moadi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 10:32 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.