moveobject help -
Mattakil - 07.04.2013
I am mapping a jail right now, and for some reason the gates wont compile, I cannot see any errors unless I am missing some SSCANF stuff.
(Note that gov123 shall be the password to open the gate)
Код:
#include <a_samp>
#include <zcmd>
new pgate1;
new pgate2;
public OnFilterScriptInit()
{
pgate1 = CreateObject(971, -2819.3171, 2651.5464, 103.3268, 0.0, 0.0, 0.0, 100.0);
pgate2 = CreateObject(971, 2855.7476, 2665.3562, 106.6561, 0.0, 0.0, 0.0, 100.0);
Create3DTextLabel("Jail\nCommands: /enter", 0x008080FF, -2827.9419, 2274.5588, 85.7897, 40.0, 0, 1);
Create3DTextLabel("Exit\nCommands: /enter", 0x008080FF, -2843.2856, 2652.1619, 98.6174, 40.0, 0, 1);
return 1;
}
COMMAND:open gov123(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171, 2651.5464, 103.3268))
{
MoveObject(pgate1, -2819.3171, 2648.8591, 103.3268, 6.0);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2855.7476, 2665.3562, 106.6561))
{
MoveObject(pgate2, -2855.7476, 2668.2810, 106.6561, 6.0);
return 1;
}
}
COMMAND:close gov123(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171, 2651.5464, 103.3268))
{
MoveObject(pgate1, -2819.3171, 2651.5464, 103.3268, 6.0);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2855.7476, 2665.3562, 106.6561))
{
MoveObject(pgate2, 2855.7476, 2665.3562, 106.6561, 6.0);
return 1;
}
}
Re: moveobject help -
Mattakil - 07.04.2013
I think I am mixing STRCMP and SSCANF somewhere, but I don't got a clue what or where
Re: moveobject help -
SilverKiller - 07.04.2013
You can't use Spaces in ZCMD commands.
Re: moveobject help -
Riddick94 - 07.04.2013
pawn Код:
COMMAND:open gov123(playerid, params[])
Convert to:
pawn Код:
COMMAND:open(playerid, params[])
{
if(isnull(params))
{
SendClientMessage(playerid, -1, "Type: /open (password)");
return true;
}
if(!strcmp(params, "gov123", false))
{
// Open gate lines.
}
return true;
}
Do the same with close command. However, I rather use sscanf for it.
Re: moveobject help -
ReVo_ - 07.04.2013
COMMAND:close_gov123(playerid, params[])
Replace spaces with "_" or make simpler commands.
Anyway
Код:
COMMAND:open_gov123(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171, 2651.5464, 103.3268))
{
MoveObject(pgate1, -2819.3171, 2648.8591, 103.3268, 6.0);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2855.7476, 2665.3562, 106.6561))
{
MoveObject(pgate2, -2855.7476, 2668.2810, 106.6561, 6.0);
return 1;
}
return 1;
}
COMMAND:close_gov123(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171, 2651.5464, 103.3268))
{
MoveObject(pgate1, -2819.3171, 2651.5464, 103.3268, 6.0);
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2855.7476, 2665.3562, 106.6561))
{
MoveObject(pgate2, 2855.7476, 2665.3562, 106.6561, 6.0);
return 1;
}
return 1;
}