Anybody know why this wont work? (gate opening) -
ifly4life - 18.12.2010
this is the exempt from the code: public OnPlayerCommandText(playerid, cmdtext[]);
if (strcmp("/open 1", cmdtext, true, 7) == 0)
{
MoveObject(1357.68286133,773.33685303,4,4);
return 1;
}
if (strcmp("/close 1", cmdtext, true,
== 0)
{
MoveObject(1357.68286133,773.33685303,12.44526672, 4)
return 1;
}
if(strcmp("/open 2", cmdtext, true, 7) == 0)
{
MoveObject(1357.40942383,713.22784424,4,4);
return 1;
}
if(strcmp("/close 2", cmdtext, true,
== 0)
{
MoveObject(1357.40942383,713.22784424,12.44526672, 4);
return 1;
}
return 0;
}
ok now this is the objects:CreateObject(980,1357.68286133,773.3368530 3,12.44526672,0.00000000,0.00000000,90.00000000); //object(airportgate) (2)
CreateObject(980,1357.40942383,713.22784424,12.445 26672,0.00000000,0.00000000,90.00000000); //object(airportgate) (3)
And the errors: C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(115) : warning 217: loose indentation
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(115) : error 029: invalid expression, assumed zero
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(115) : error 017: undefined symbol "playerid"
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(117) : warning 217: loose indentation
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(117) : error 017: undefined symbol "cmdtext"
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(119) : warning 213: tag mismatch
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(119) : warning 202: number of arguments does not match definition
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(123) : error 017: undefined symbol "cmdtext"
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(125) : warning 213: tag mismatch
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(125) : warning 202: number of arguments does not match definition
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(126) : error 001: expected token: ";", but found "return"
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(129) : error 017: undefined symbol "cmdtext"
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(131) : warning 213: tag mismatch
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(131) : warning 202: number of arguments does not match definition
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(135) : error 017: undefined symbol "cmdtext"
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(137) : warning 213: tag mismatch
C:\Users\Brad\Documents\Scripts\Airport Gates.pwn(137) : warning 202: number of arguments does not match definition
So does anybody know how to fix it if not what are the commands i need a open and close for each gate...?
Re: Anybody know why this wont work? (gate opening) -
blackwave - 18.12.2010
Use next time, please.
Try that:
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
if (strcmp("/open 1", cmdtext, true, 7) == 0)
{
MoveObject(1357.68286133,773.33685303,4,4);
return 1;
}
if (strcmp("/close 1", cmdtext, true, == 0)
{
MoveObject(1357.68286133,773.33685303,12.44526672, 4)
return 1;
}
if(strcmp("/open 2", cmdtext, true, 7) == 0)
{
MoveObject(1357.40942383,713.22784424,4,4);
return 1;
}
if(strcmp("/close 2", cmdtext, true, == 0)
{
MoveObject(1357.40942383,713.22784424,12.44526672, 4);
return 1;
}
return 0;
}
Re: Anybody know why this wont work? (gate opening) -
ifly4life - 18.12.2010
Still wont compile
Re: Anybody know why this wont work? (gate opening) -
Ash. - 18.12.2010
Quote:
Originally Posted by blackwave
Use next time, please.
|
Did you mean:
Use [pawn][/pawn] next time, please.
?
Re: Anybody know why this wont work? (gate opening) -
blackwave - 18.12.2010
Quote:
Originally Posted by funky1234
Did you mean:
Use [/noparse] next time, please.
?
|
o_o. Just didn't show lmao XD. [pawn][/pawn]
I put with 1 space between lols XD
Re: Anybody know why this wont work? (gate opening) -
Mikkel_Pedersen - 18.12.2010
Keep in mind that 'MoveObject' also needs an object id.
pawn Код:
MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed)
Re: Anybody know why this wont work? (gate opening) -
ifly4life - 18.12.2010
oh the objectid never thought of that
Re: Anybody know why this wont work? (gate opening) -
blackwave - 18.12.2010
Quote:
Originally Posted by ifly4life
oh the objectid never thought of that
|
lol. Ya, makes sense. How can you move something you didn't craft / think ? xd
Re: Anybody know why this wont work? (gate opening) -
jonnyboy - 18.12.2010
pawn Код:
/*==============================================================================
* MADE BY JONNYBOY =
* http://rpswen.freeforums.org/ =
*=============================================================================*/#define FILTERSCRIPT#define COLOR_YELLOW 0xFFFF00AA#include <a_samp>new O1;
new O2;
#if defined FILTERSCRIPTforward close
();
public OnFilterScriptInit
(){ print(" Gates");
return 1;
}public OnFilterScriptExit
(){ return 1;
}#elsemain
(){ print(" ");
}#endifpublic OnGameModeInit
(){ O1
= CreateObject
(1357,
68286133,
773.33685303,
4,
0.00000000,
0.00000000,
0.00000000);
O2
= CreateObject
(1357,
40942383,
713.22784424,
4,
0.00000000,
90.00000000,
90.00000000);
return 1;
}public close
(){ MoveObject
(O1,
68286133,
773.33685303,
4,
3.00);
MoveObject
(O2,
1357,
40942383,
713.22784424,
4,
3.00);
return 1;
}public OnPlayerCommandText
(playerid, cmdtext
[]){ if (strcmp("/open1", cmdtext, true,
10) == 0) { MoveObject
(O1,
68286133,
773.33685303,
12.44526672,
2.00);
SetTimer
("close",
7000,
0);
//gate will be closed for 7 seconds SendClientMessage
(playerid,COLOR_YELLOW,
"enter text here");
return 1;
} if (strcmp("/open2", cmdtext, true,
10) == 0) { MoveObject
(O2,
40942383,
713.22784424,
12.44526672,
2.00);
SetTimer
("close",
7000,
0);
//gate will be closed for 7 seconds SendClientMessage
(playerid,COLOR_YELLOW,
"enter text here");
return 1;
} return 0;
}
if the cords are wrong you need to re make them "x, y, z"
Re: Anybody know why this wont work? (gate opening) -
WillyP - 18.12.2010
pawn Код:
#include <a_samp>
#define COLOR_YELLOW 0xFFFF00AA
new O1;
new O2;
forward close();
public OnFilterScriptInit()
{
print(" Gates");
O1 = CreateObject(1357,68286133,773.33685303,4,0.00000000,0.00000000,0.00000000);
O2 = CreateObject(1357,40942383,713.22784424,4,0.00000000,90.00000000,90.00000000);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/open1", cmdtext, true, 10) == 0)
{
MoveObject(O1,68286133,773.33685303,12.44526672, 2.00);
SetTimer("close", 7000, 0);//gate will be closed for 7 seconds
SendClientMessage(playerid,COLOR_YELLOW,"enter text here");
return 1;
}
if (strcmp("/open2", cmdtext, true, 10) == 0)
{
MoveObject(O2,40942383,713.22784424,12.44526672, 2.00);
SetTimer("close", 7000, 0);//gate will be closed for 7 seconds
SendClientMessage(playerid,COLOR_YELLOW,"enter text here");
return 1;
}
return 0;
}
public close()
{
MoveObject(O1,68286133,773.33685303,4, 3.00);
MoveObject(O2,1357,40942383,713.22784424,4, 3.00);
return 1;
}
Jonnyboy's but removed unwanted stuff and re-arranged to make it easier to read.