SA-MP Forums Archive
Password Gates Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Password Gates Problem (/showthread.php?tid=324830)



Password Gates Problem - Ryan_Obeles - 10.03.2012

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


AW: Password Gates Problem - Ryan_Obeles - 11.03.2012

anyone Pls help me


AW: Password Gates Problem - Ryan_Obeles - 11.03.2012

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


Re: Password Gates Problem - Reklez - 11.03.2012

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.


AW: Password Gates Problem - Ryan_Obeles - 11.03.2012

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


AW: Password Gates Problem - Ryan_Obeles - 11.03.2012

and pls if u know make it in zcmd for me


Re: Password Gates Problem - misho1 - 11.03.2012

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