I kind needed this done for tomorrow, and I am stuck on one fucking part. I am making a password system for gates and when you type /gate open, a dialog comes up for pass and whatever. I tried the script with a toll gate system and it worked fine as well as just /gate open.
hmm there is no point in solving this as u have given an incomplete script see that there is The word "You are not near the gate" doesnt that mean there should be some rangepoint the player should be in give us full ondialogresponse please...
Код:
//Script By Matt
#define FILTERSCRIPT
#include <a_samp>
//===========================================
// Gate Definition
//===========================================
new hentrance;
new hexit;
new pdlot;
new pdgarage;
#define pdlotmenu 123
//===========================================
// Timer Definition
//===========================================
forward henttimer();
forward hexittimer();
#if defined FILTERSCRIPT
//=================================================================================================================
// CreateObject
//=================================================================================================================
public OnFilterScriptInit()
{
hentrance = CreateObject(968,1267.8000488,-1842.0000000,13.3000002,0.0000000,90.0000000,358.7498169);
hexit = CreateObject(968,1216.0000000,-1842.3000488,13.1999998,0.0000000,270.0000000,0.0000000);
pdlot = CreateObject(968,1544.6999512,-1630.9000244,13.1000004,0.0000000,90.0000000,90.0000000);
}
//================================================================================================================
// Toll Gates
//================================================================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/paytoll", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1270.8000488281, -1845.6999511719, 13.39999961853))
{
GivePlayerMoney(playerid, -20);
SendClientMessage(playerid, 0xFFFFFFAA, "{D8D8D8}Booth Guard: {0101DF} You Have Paid The Toll of $20");
MoveObject(hentrance,1267.8000488,-1842.0000000,13.3000002,5.0,0,20,358.74981689453);
SetTimer("henttimer", 6000, false);
SendClientMessage(playerid, 0xFF8000AA, "Note: Gate will close in 6 seconds!");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You Are Not Near A Toll Gate!");
}
return 1;
}
//====================================================================================================
// Open Gates (anyone can use, no password or toll)
//====================================================================================================
if(strcmp("/gate open", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1213.0999755859, -1839.8000488281, 13.39999961853))
{
MoveObject(hexit,1216.0000000,-1842.3000488,13.1999998,5.0,0,340,358);
SetTimer("hexittimer", 6000, false);
SendClientMessage(playerid, 0xFF8000AA, "Note: Gate will close in 6 seconds!");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You Are Not Near A Gate!");
}
return 1;
}
//====================================================================================================
// Command to close ALL gates with /gate close
//====================================================================================================
if(strcmp("/gate close", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 1544.3000488281, -1627.4000244141, 13.39999961853))
{
MoveObject(pdlot,1544.6999512,-1630.9000244,13.1000004,5.0,0,90.00000,89.999969482422);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You Are Not Near A Gate!");
}
return 1;
}
//====================================================================================================
// Put all timer IDs from the auto closing gates here
//======================
//====================================================================================================
// Password Gates
//====================================================================================================
if(strcmp("/gate open", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 1544.3000488281, -1627.4000244141, 13.39999961853))
{
ShowPlayerDialog(playerid, pdlotmenu, DIALOG_STYLE_INPUT, "Password", "Enter Your Password", "Enter", "Cancel");
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == pdlotmenu)
{
if(!strcmp("lspd", inputtext, true, 12))
{
MoveObject(pdlot,1544.6999512,-1630.9000244,13.1000004,5.0,0,34.749847412109,89.999969482422);
return 1;
}
return 1;
}
return 0;
}
public henttimer()
{
MoveObject(hentrance,1267.8000488,-1842.0000000,13.3000002,5.0,0.0000000,90.0000000,358.7498169);
}
public hexittimer()
{
MoveObject(hexit,1216.0000000,-1842.3000488,13.1999998,5.0,0,270,358);
}
//====================================================================================================
public OnFilterScriptExit()
{
return 1 ;
}
#endif