MOVE object problem...
#5

Quote:
Originally Posted by Badger(new)
Посмотреть сообщение
pawn Код:
if(strcmp(cmd,"/openagate1", true)==0) {
    MoveObject(971, 2897.9375, -2051.705078125, 5.4179458618164, 1);
    return 1;
}
CreateObject(971, 2897.9375, -2051.705078125, 5.4179458618164, 0, 0, 268.24768066406);
if(strcmp(cmd, "/closeagate1", true)==0) {
    MoveObject(971, 2897.9375, -2051.705078125, 5.4179458618164,1);
    return 1;
}
You're doing it wrong.
Put all your CreateObjects under
pawn Код:
public OnGameModeInit()
NOT, under OnPlayerCommandText.

At the top of your script, below the includes, put:
pawn Код:
new gate[replace me with how many gates you have];
Then infront of your objects which are your gates, put:
pawn Код:
gate[0]=CreateObject(blahblahblah);
So it will look like this:
pawn Код:
public OnGameModeInit(){
    gate[0]=CreateObject(blahblahblah);//Start on gate[0], not gate[1] so you can have more IDs
    gate[1]=CreateObject(blahblahblah);
    gate[2]=CreateObject(blahblahblah);
    //Make sure the number in gate[ ] is not the same as another object's number
    // Make sure the number in new gate[ ] is the number of gates you have
    return 1;
}
And to open the gates:
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]){
    if(!strcmp(cmdtext,"/OpenGate1",true)){
        MoveObject(gate[replace me with the gate you want to move],new x, new y, new z, speed);
        return 1;
    }
    return 0;
}
e.g.
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]){
    if(!strcmp(cmdtext,"/OpenGate1",true)){
        MoveObject(gate[0],500.0,1337.13, 157.454,5);
        return 1;
    }
    if(!strcmp(cmdtext,"/OpenGate2",true)){
        MoveObject(gate[1],-412.144, 1646.454, 494.54524, 10);
        return 1;
    }
    return 0;
}
Also, as they said, you've done something wrong above what you posted.


then I get this:

C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(37) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(3 : error 021: symbol already defined: "gate"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(40) : error 021: symbol already defined: "gate"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

36. new gate[0]
37. new gate[1]
38. new gate[2]
39.
40. static iPlayerChatTime[MAX_PLAYERS];
Reply


Messages In This Thread
MOVE object problem... - by knackworst - 23.10.2010, 21:19
Re: MOVE object problem... - by Mike_Peterson - 23.10.2010, 21:25
Re: MOVE object problem... - by Badger(new) - 23.10.2010, 21:39
Re: MOVE object problem... - by Rafa - 23.10.2010, 21:39
Re: MOVE object problem... - by knackworst - 23.10.2010, 22:30
Re: MOVE object problem... - by Badger(new) - 23.10.2010, 22:41
Re: MOVE object problem... - by knackworst - 23.10.2010, 22:43
Re: MOVE object problem... - by Badger(new) - 23.10.2010, 22:45
Re: MOVE object problem... - by knackworst - 24.10.2010, 10:43
Re: MOVE object problem... - by Rafa - 24.10.2010, 11:00

Forum Jump:


Users browsing this thread: 1 Guest(s)