House Password? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: House Password? (
/showthread.php?tid=100722)
House Password? -
TheNotorius - 06.10.2009
Hello all, i was thinking..that i need a password for one of my admin houses, so how would i do that?
Because ive already set the Isplayeradmin thing but i need a password to verify it, so any ideas please?
P.S Its off crazybobs
Re: House Password? -
Gappy - 06.10.2009
Try something like
pawn Код:
new PasswordScreen[MAX_PLAYERS]; // Top of your script
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if(PlayerToPoint(2, playerid, HouseX, HouseY, HouseZ); //fill your house icon co-ords in here
{
if(IsPlayerAdmin(playerid))
{
PasswordScreen[playerid] = 1;
SendClientMessage(playerid, YourColorHere, "Press T and type in the password");
}
}
return 1;
}
return 0;
}
public OnPlayerText(playerid, text[])
{
if(PasswordScreen[playerid] == 1)
{
PasswordScreen[playerid] = 0;
if(strcmp(text, "PutThePasswordInHere", 1) == 0) //Fill in the house password
{
//Password is correct
//House stuff goes in here, SetPlayerPos, SetPlayerInterior etc etc
}
else SendClientMessage(playerid, YourColorHere, "Incorrect Password"); //Password is incorrect
return 0;
}
return 1;
}
You will need PlayerToPoint for that, or just edit it to whatever you use for that stuff.
Note: Untested. and indentation looks horrible on the forums.
Re: House Password? -
TheNotorius - 06.10.2009
Quote:
Originally Posted by Gappy
Try something like
pawn Код:
new PasswordScreen[MAX_PLAYERS]; // Top of your script
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/enter", cmdtext, true, 10) == 0) { if(PlayerToPoint(2, playerid, HouseX, HouseY, HouseZ); //fill your house icon co-ords in here { if(IsPlayerAdmin(playerid)) { PasswordScreen[playerid] = 1; SendClientMessage(playerid, YourColorHere, "Press T and type in the password"); } } return 1; } return 0; }
public OnPlayerText(playerid, text[]) { if(PasswordScreen[playerid] == 1) { PasswordScreen[playerid] = 0; if(strcmp(text, "PutThePasswordInHere", 1) == 0) //Fill in the house password { //Password is correct //House stuff goes in here, SetPlayerPos, SetPlayerInterior etc etc } else SendClientMessage(playerid, YourColorHere, "Incorrect Password"); //Password is incorrect return 0; } return 1; }
You will need PlayerToPoint for that, or just edit it to whatever you use for that stuff.
Note: Untested. and indentation looks horrible on the forums.
|
Alrite thanks for that ^^ ill test it out now
Re: House Password? -
eXchainZ-FoReVeR - 06.10.2009
I've tested it, Works fine
Re: House Password? -
ferriswheel - 06.10.2009
If you're using a player command (in this example "/enter"), wouldn't it be easier for the player to type "/enter [password]" rather then having to open the chatbox again and type the password?
Re: House Password? -
TheNotorius - 07.10.2009
Thanks it works like a charm
Re: House Password? -
Gappy - 07.10.2009
No Probs