Lock Team -
Bulgaria - 12.04.2016
Hello i want to lock team TF141 with password... How to do it? Here is the code:
PHP код:
// Teams
#define TEAM_CIVIL 0
#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_VAGOS 3
#define TEAM_AZTECAS 4
#define TEAM_LSPD 5
#define TEAM_TF141
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
gPlayerClass[playerid] = classid;
switch (classid) {
case 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19:
{
gTeam[playerid] = TEAM_CIVIL;
GameTextForPlayer(playerid, "~y~~h~~h~CIVILIAN", 1000, 6);
}
case 20,21,22:
{
gTeam[playerid] = TEAM_GROVE;
GameTextForPlayer(playerid, "~g~Grove Street Families", 1000, 6);
ApplyAnimation(playerid,"PED","strip_G",4.1,1,1,1,1,1);
}
case 23,24,25:
{
gTeam[playerid] = TEAM_BALLAS;
GameTextForPlayer(playerid, "~p~Front Yard Ballas", 1000, 6);
ApplyAnimation(playerid,"PED","strip_G",4.1,1,1,1,1,1);
}
case 26,27,28:
{
gTeam[playerid] = TEAM_VAGOS;
GameTextForPlayer(playerid, "~y~Los Santos Vagos", 1000, 6);
ApplyAnimation(playerid,"PED","strip_G",4.1,1,1,1,1,1);
}
case 29,30,31:
{
gTeam[playerid] = TEAM_AZTECAS;
GameTextForPlayer(playerid, "~b~~h~~h~Vario Los Azteca", 1000, 6);
}
case 32,33,34,35:
{
gTeam[playerid] = TEAM_LSPD;
GameTextForPlayer(playerid, "~y~~h~~h~LOS SANTOS POLICE DEPARTAMENT", 1000, 6);
}
}
SetPlayerPos(playerid, 2524.2695,-1696.2926,18.2204);
SetPlayerFacingAngle( playerid, 2.3616 );
SetPlayerCameraPos(playerid, 2523.7749,-1692.6855,18.9011);
SetPlayerCameraLookAt(playerid, 2524.2695,-1696.2926,18.2204);
return 1;
}
If you need player class tell me
Re: Lock Team -
NaS - 12.04.2016
You need to add the class like all others, however in OnPlayerRequestSpawn do the following:
Код:
public OnPlayerRequestSpawn(playerid)
{
if(gTeam[playerid] == TEAM_TF141)
{
ShowPlayerDialog(playerid, DIALOG_CLASS_TF141, DIALOG_STYLE_PASSWORD, "Password protected Class", "Please enter a Password to choose this Class:", "Spawn", "Back"); // password dialog
return 0; // Prevents Spawn
}
return 1;
}
Then, in OnDialogResponse:
Код:
if(dialogid == DIALOG_CLASS_TF141) // I name dialog ID defines like this, replace with your ID from ShowPlayerDialog!
{
if(response)
{
if(strcmp(inputtext, "YourPassword", false) == 0 && strlen(inputtext) != 0)
{
SpawnPlayer(playerid); // Entered correct password, may spawn
}
else
{
// Wrong password, tell the player
}
}
return 1;
}
This should work fine, even on respawning. If the player changes the class to some other and then back, he has to re-enter the password though.
Make sure you also set gTeam to TEAM_TF141 like (for example) TEAM_AZTECAS inside OnPlayerRequestClass. Also the define TEAM_TF141 needs a value (6 I guess).
Re: Lock Team -
Bulgaria - 12.04.2016
PHP код:
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1228) : error 017: undefined symbol "DIALOG_CLASS_TF141"
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1429) : error 017: undefined symbol "DIALOG_CLASS_TF141"
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1445) : warning 209: function "OnDialogResponse" should return a value
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Re: Lock Team -
Godey - 12.04.2016
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 0; // you forgot this :)
}
If you fix this, other errors get fixed too!
Remember the format
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CLASS_TF141) // I name dialog ID defines like this, replace with your ID from ShowPlayerDialog!
{
if(response)
{
if(strcmp(inputtext, "YourPassword", false) == 0 && strlen(inputtext) != 0)
{
SpawnPlayer(playerid); // Entered correct password, may spawn
}
else
{
// Wrong password, tell the player
}
}
}
if(statement)
{
// (Arguements)
}
return 0;
}
[NaS's command]
Re: Lock Team -
Bulgaria - 12.04.2016
PHP код:
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1228) : error 017: undefined symbol "DIALOG_CLASS_TF141"
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1430) : error 017: undefined symbol "DIALOG_CLASS_TF141"
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1447) : error 029: invalid expression, assumed zero
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1447) : error 004: function "OnPlayerClickPlayer" is not implemented
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1451) : error 030: compound statement not closed at the end of file (started at line 1430)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.
Re: Lock Team -
Godey - 12.04.2016
Post your OnPlayerDialogResponse so I can check
Re: Lock Team -
Bulgaria - 12.04.2016
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CLASS_TF141) // I name dialog ID defines like this, replace with your ID from ShowPlayerDialog!
{
if(response)
{
if(strcmp(inputtext, "1820141", false) == 0 && strlen(inputtext) != 0)
{
SpawnPlayer(playerid); // Entered correct password, may spawn
}
else
{
SendClientMessage(playerid, COLOR_RED, "Грешна парола!");
}
return 1;
}
return 0;
}
Re: Lock Team -
Godey - 12.04.2016
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_CLASS_TF141) // I name dialog ID defines like this, replace with your ID from ShowPlayerDialog!
{
if(response)
{
if(strcmp(inputtext, "1820141", false) == 0 && strlen(inputtext) != 0)
{
SpawnPlayer(playerid); // Entered correct password, may spawn
}
else
{
SendClientMessage(playerid, COLOR_RED, "Грешна парола!");
}
return 1;
}
} // Forgot this? :D
return 0;
}
Re: Lock Team -
Bulgaria - 12.04.2016
PHP код:
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1228) : error 017: undefined symbol "DIALOG_CLASS_TF141"
C:\Users\Борисов\Desktop\BG RP Server\gamemodes\BG1.2.pwn(1430) : error 017: undefined symbol "DIALOG_CLASS_TF141"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Re: Lock Team -
Godey - 12.04.2016
Put this on top near the other
#define (s)
Код:
#define DIALOG_CLASS_TF141 1025 // you can use any number other than 1025
Solved?