I'm getting error while compiling (Noob) -
DwayneMichael - 11.06.2016
Hello,
Please I need help, I am trying to make cmds for opening gates. I'm new at this and I can't figure out the solution..
Codes
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/vipgo", cmdtext, true, 7) == 0)
{
MoveObject(gate1,-2429.74829, 697.10651, 27.89320, 1);
SendClientMessage(playerid, 0xEF994300, "The gate has opened, Welcome.");
}
return 1;
}
if (strcmp("/vipgc", cmdtext, true, 7) == 0)
{
MoveObject(gate1,-2429.74829, 697.10651, 34.18119,1);
SendClientMessage(playerid, 0xEF994300, "The gate has closed.");
}
return 1;
}
return 0;
}
Errors:
GM.pwn (507): error 010: invalid function or declaration
GM.pwn(512) : error 010: invalid function or declaration
GM.pwn(514) : error 010: invalid function or declaration
507 is: if (strcmp("/vipgc", cmdtext, true, 7) == 0)
Please help, Would really appreciate if someone would fix this and reply the correct codes below.
Re: I'm getting error while compiling (Noob) -
Stinged - 11.06.2016
Here's the code indented:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/vipgo", cmdtext, true, 7) == 0)
{
MoveObject(gate1,-2429.74829, 697.10651, 27.89320, 1);
SendClientMessage(playerid, 0xEF994300, "The gate has opened, Welcome.");
}
return 1;
}
if (strcmp("/vipgc", cmdtext, true, 7) == 0)
{
MoveObject(gate1,-2429.74829, 697.10651, 34.18119,1);
SendClientMessage(playerid, 0xEF994300, "The gate has closed.");
}
return 1;
}
return 0;
}
You have the "vipgc" command outside of the function.
It should be like this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/vipgo", cmdtext, true, 7) == 0)
{
MoveObject(gate1,-2429.74829, 697.10651, 27.89320, 1);
SendClientMessage(playerid, 0xEF994300, "The gate has opened, Welcome.");
return 1;
}
if (strcmp("/vipgc", cmdtext, true, 7) == 0)
{
MoveObject(gate1,-2429.74829, 697.10651, 34.18119,1);
SendClientMessage(playerid, 0xEF994300, "The gate has closed.");
return 1;
}
return 0;
}
And you should start using
zcmd.
It's much faster than what you're doing, and it's a lot easier to code with.
Re: I'm getting error while compiling (Noob) -
DwayneMichael - 11.06.2016
Thanks a lot, It worked.