Checkpoint Password
#1

Hi
I need something where a player enters a checkpoint and then types a /password... if it is correct, the player will then only be teleported. here is what i have:

Код:
public OnPlayerSpawn(playerid)
{
 	SetPlayerCheckpoint(playerid, -129.3005,2255.2163,27.7829,3.0);
	return 1;
}
and...

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	SetPlayerInterior(playerid, 3);
	SetPlayerPos(playerid, 964.106994,-53.205497,1001.124572);
	SendClientMessage(playerid, COLOR_RED, "Welcome To CDB and dayav07's Hideout");
	return 1;
}
Please help me out thanx
Reply
#2

Quote:
Originally Posted by dayav07
Hi
I need something where a player enters a checkpoint and then types a /password... if it is correct, the player will then only be teleported. here is what i have:

Код:
public OnPlayerSpawn(playerid)
{
 	SetPlayerCheckpoint(playerid, -129.3005,2255.2163,27.7829,3.0);
	return 1;
}
and...

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	SetPlayerInterior(playerid, 3);
	SetPlayerPos(playerid, 964.106994,-53.205497,1001.124572);
	SendClientMessage(playerid, COLOR_RED, "Welcome To CDB and dayav07's Hideout");
	return 1;
}
Please help me out thanx
Which version are you using? 0.2X or 0.3?
Reply
#3

make it like ,

pawn Код:
new teleport;


//this under ongamemodeinit
teleport = SetPlayerCheckpoint(playerid, -129.3005,2255.2163,27.7829,3.0);

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInCheckpoint(playerid,teleport ))
{
SendClientMessage(playerid, color , "Enter Password!);
}
return 1;
}
pawn Код:
// this under onplayercommand
}
if(!strcmp(cmdtext, "/passwordname", true))
{
if(IsPlayerInCheckpoint(playerid,teleport ))
{
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, 964.106994,-53.205497,1001.124572);
SendClientMessage(playerid, COLOR_RED, "Welcome To CDB and dayav07's Hideout");
}
return 1;
Reply
#4

I am using 0.2X

I need to know what to do for the following:

When the player enters the checkpoint, teh server displays : "enter password"
Then the player does /password
If it is correct, he is teleported to the co-ordinates
if wrong, nothing happens
Reply
#5

make it like ,

pawn Код:
new teleport;


//this under ongamemodeinit
teleport = SetPlayerCheckpoint(playerid, -129.3005,2255.2163,27.7829,3.0);

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInCheckpoint(playerid,teleport ))
{
SendClientMessage(playerid, color , "Enter Password!);
}
return 1;
}
pawn Код:
// this under onplayercommand
}
if(!strcmp(cmdtext, "/passwordname", true))
{
if(IsPlayerInCheckpoint(playerid,teleport ))
{
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, 964.106994,-53.205497,1001.124572);
SendClientMessage(playerid, COLOR_RED, "Welcome To CDB and dayav07's Hideout");
}
return 1;
Reply
#6

Have you thought of use /password command with parameters? I would do it in dcmd
For example:
pawn Код:
dcmd_password(playerid, params[])
{
   if (IsPlayerInCheckpoint(playerid) == 0) SendClientMessage(playerid, COLOR_RED, "You must be in the checkpoint to use this command");
   else
   {
     if (strlen(params) == 0) SendClientMessage(playerid, COLOR_RED, "Usage: /password [password]");
     else
     {
        if ((strmid(params, "Example", false) && (strlen(params) == 7))
        {
          SetPlayerInterior(playerid, 3);
          SetPlayerPos(playerid, 964.106994, -53.205497, 1001.124572);
          SendClientMessage(playerid, COLOR_RED, "Welcome To CDB and dayav07's Hideout");
        }
        else SendClientMessage(playerid, COLOR_RED, "Incorrect password!");
     }
   }
   return 1;
}
In this example, a player will be teleported to the hideout, if he writes /password Example and if he's in the checkpoint
Of course Example can be changed for any other string (but remember to change value of 7 in second condition - length of your password string)
Reply
#7

THANX

I had to play around with it a little but it worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)