Код:
if(!strcmp(cmdtext, "/hg", true) || !strcmp(cmdtext, "/housegate", true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Please enter the gate's password.");
return 1;
}
for(new s = 0; s <= sizeof(GateInfo); s++)
{
if(strcmp(tmp, GateInfo[s][gCode], true) == 0)
{
if(GateInfo[s][gStatus] == 0)
{
GateInfo[s][gStatus] = 1;
new Float:bridqs;
bridqs = GateInfo[s][Poz] - 5.0;
MoveDynamicObject(housegate[s], GateInfo[s][Pox], GateInfo[s][Poy], bridqs, 0.8);
SendClientMessage(playerid, COLOR_WHITE, "Opened the gated.");
return 1;
}
else
{
GateInfo[s][gStatus] = 0;
MoveDynamicObject(housegate[s], GateInfo[s][Pox], GateInfo[s][Poy], GateInfo[s][Poz], 0.8);
SendClientMessage(playerid, COLOR_WHITE, "Closed the gated.");
return 1;
}
}
}
return 1;
}
But when I type it I receive an unknown command error.
Ok I'll try it . Thanks
No ... The same error.
I might be wrong but i think you be better off using Dialogs if its gonna be a passworded gate..
Here An Example just Change the cordinates to ur gate location and Model ID IF there any errors please tell me.. I Included a description on what they do....
pawn Код:
#include <a_samp>
#include <streamer>
#define NEWSGATE_PASSWORD "/passwords/newsgate/password21.ini" // change that its the password but include "password21"
#define error 0xFF0000FF
#define normal 0xFFFFFFFF
forward GateClose(playerid);
new newsgate1;
new newsgate;
#define DIALOG_Gate_1
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public GateClose(playerid)
{
MoveDynamicObject(newsgate1,777.52178955078, -1384.7537841797, 14.225526809692 , 0.97); /// This lines to close the gate
PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960); /// just a gate sound
newsgate = 0;
return 1;
}
public OnGameModeInit()
{
newsgate1 = CreateDynamicObject(975, 777.52178955078, -1384.7537841797, 14.225526809692, 0, 0, 180.09997558594);//Make sure you put the closed gate here
SetGameModeText("Blank Script");
AddPlayerClass(0, 777.52178955078, -1384.7537841797, 14.225526809692, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{ // I just use this here for shortcut to the Gate hehe
SetPlayerPos(playerid, 777.52178955078, -1384.7537841797, 14.225526809692);
SetPlayerCameraPos(playerid, 777.52178955078, -1384.7537841797, 14.225526809692);
SetPlayerCameraLookAt(playerid, 777.52178955078, -1384.7537841797, 14.225526809692);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/newsgate", cmdtext, true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 15.0,777.52178955078, -1384.7537841797, 14.225526809692)) // This is where player is in range of gate
{
ShowPlayerDialog(playerid, DIALOG_GATE_1, DIALOG_STYLE_INPUT, "Security Gate", "Hello How Are you Today, Please Punch In Your Passcode", "Open", "Cancel");
}
else
{
SendClientMessage(playerid, error, " Your Not Near The News Gate ");
}
}
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_GATE_1)
{
if(!response)
{
SendClientMessage(playerid, error, " Okay Access Denied Have a Nice Day!");
}
if(!strcmp(inputtext, NEWSGATE_PASSWORD, true))
{
SendClientMessage(playerid, error, "Invalid Passcode");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Security Gate", "One More Chance, Please Punch In Your Passcode", "Open", "Cancel");
}
else
{
if(newsgate == 1) { SendClientMessage(playerid, error, "** Security Gate is Open"); return 1; }
MoveDynamicObject(newsgate1,769.52178955078, -1384.7537841797, 14.225526809692, 0.97); // to open the gate
SetTimer("GateClose", 12000, 0); /// timer to close in 7 seconds
new Gatemessage[64];
format(Gatemessage, 64,"Security Gate will close in 7 seconds");
GameTextForAll(Gatemessage, 5000, 3);
PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
newsgate = 1;
}
}
return 1;
}
I transfered it to Dialogs and it worked. Thanks !