Password Gates Problem
#1

i need help with my password gates so here are the code :

================================================== ========

#include <a_samp>

new Gate,
bool:IsOpened,
password[24] = "UDZ";

//forwards
forward UDZ(playerid);

public OnFilterScriptInit()
{
Gate = CreateObject(980,238.10000610,-1807.69995117,6.19999981,0.00000000,0.00000000,0.0 0000000);
IsOpened = false; //set it's status to closed

//objects
CreateObject(3606,247.19999695,-1825.69995117,6.30000019,0.00000000,0.00000000,180 .00000000); //object(bevbrkhus1) (1)
CreateObject(987,257.00000000,-1832.50000000,2.90000010,0.00000000,0.00000000,90. 00000000); //object(elecfence_bar) (1)
CreateObject(987,245.10000610,-1832.40002441,2.90000010,0.00000000,0.00000000,0.0 0000000); //object(elecfence_bar) (2)
CreateObject(987,233.10000610,-1832.40002441,2.90000010,0.00000000,0.00000000,0.0 0000000); //object(elecfence_bar) (3)
CreateObject(987,221.10000610,-1832.40002441,2.90000010,0.00000000,0.00000000,0.0 0000000); //object(elecfence_bar) (4)
CreateObject(987,209.10000610,-1832.40002441,2.90000010,0.00000000,0.00000000,0.0 0000000); //object(elecfence_bar) (5)
CreateObject(987,208.69999695,-1820.50000000,2.90000010,0.00000000,0.00000000,272 .00000000); //object(elecfence_bar) (6)
CreateObject(987,208.30000305,-1808.59997559,2.90000010,0.00000000,0.00000000,271 .99951172); //object(elecfence_bar) (7)
CreateObject(987,257.00000000,-1820.59997559,2.90000010,0.00000000,0.00000000,90. 00000000); //object(elecfence_bar) (
CreateObject(987,257.10000610,-1808.69995117,2.90000010,0.00000000,0.00000000,180 .00000000); //object(elecfence_bar) (9)
CreateObject(987,220.10000610,-1808.50000000,2.90000010,0.00000000,0.00000000,179 .99450684); //object(elecfence_bar) (10)
CreateObject(987,232.00000000,-1808.50000000,2.90000010,0.00000000,0.00000000,179 .99450684); //object(elecfence_bar) (11)
CreateObject(3749,238.10000610,-1809.40002441,9.30000019,0.00000000,0.00000000,0.0 0000000); //object(clubgate01_lax) (1)
CreateObject(3606,219.00000000,-1825.59997559,6.30000019,0.00000000,0.00000000,179 .99450684); //object(bevbrkhus1) (2)
return 1;
}

public UDZ(playerid)
{
TogglePlayerControllable(playerid,true);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/gate",cmdtext,true))
{
if(!IsPlayerInRangeOfPoint(playerid,10.0,246.0052,-1806.2119,4.4689,178.5597))
return SendClientMessage(playerid,-1, "You aren't near any gate!");
if(strlen(cmdtext) < 22)
return SendClientMessage(playerid,-1,"Usage: /gate [password]");
if(strcmp(cmdtext[22],password,true))
return SendClientMessage(playerid,-1,"Wrong Password!");

switch(IsOpened)
{
case true:
{
IsOpened = false;
SendClientMessage(playerid,-1,"Gate is closing!");
MoveObject(Gate, 238.10000610,-1807.69995117,6.19999981,5.0);
}
case false:
{
IsOpened = true;
SendClientMessage(playerid,-1,"Gate is opening!");
MoveObject(Gate, 238.10000610,-1807.69995117,11.50000000,5.0);
}
}
return 1;
}
return 0;
}


if u can help me pls post it so i can do my gates already

advance thx
Reply
#2

anyone Pls help me
Reply
#3

my server also says when i do /gate UDZ my serer syas "unknown command
Reply
#4

pawn Код:
if(strcmp("/gate",cmdtext,true))
{
      if(!IsPlayerInRangeOfPoint(playerid,10.0,246.0052,-1806.2119,4.4689,178.5597)) return SendClientMessage(playerid,-1, "You aren't near any gate!");
      if(strlen(cmdtext) < 22) return SendClientMessage(playerid,-1,"Usage: /gate [password]");
      if(strcmp(cmdtext[22],password,true)) return SendClientMessage(playerid,-1,"Wrong Password!");
      return 1;
}
use ZCMD, if you make more and more commands with strcmp, your server will be lag or slow.
Reply
#5

noo i only want strcmp thats the thing i know pls help me with that
Reply
#6

and pls if u know make it in zcmd for me
Reply
#7

pawn Код:
COMMAND:gate(playerid, params[])
{
        if(!IsPlayerInRangeOfPoint(playerid,10.0,246.0052,-1806.2119,4.4689,178.5597)) return SendClientMessage(playerid,-1, "You aren't near any gate!");
      if(strlen(params) < 22) return SendClientMessage(playerid,-1,"Usage: /gate [password]");
      if(strcmp(params[22],password,true)) return SendClientMessage(playerid,-1,"Wrong Password!");
  return 1;
}
not tested
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)