SA-MP Forums Archive
Password to skin - 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 to skin (/showthread.php?tid=603999)



Password to skin - Bulgaria - 30.03.2016

If it is possible to set password to some skins

here what i want... on this skin lapd1, sfpd1, lvpd1, lapdm1, csher, dsher and FBI
when someone choose player when reach this skins and try to select i want to show up a window and set the password to play whit this skins and another password to this 2 skins SWAT, ARMY... thx in advance


Re: Password to skin - saffierr - 30.03.2016

I don't understand your translated english...


Re: Password to skin - Mencent - 30.03.2016

Hi!

Yes, it's possible. Can you show us how you set the skin to the player so that we can help you to put in the code with the password.


Re: Password to skin - Bulgaria - 30.03.2016

Quote:

public OnGameModeInit()
{
//Text
SetGameModeText("TWD1.0");
//Running Style
UsePlayerPedAnims();
//Скинове
AddPlayerClass(280,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
AddPlayerClass(281,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
AddPlayerClass(282,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
AddPlayerClass(283,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
AddPlayerClass(284,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
AddPlayerClass(285,1547.4600,-1640.0782,28.4021,89.8322,0,0,0,0,0,0); // SniperMan
AddPlayerClass(286,1572.1573,-1611.5800,13.3828,87.7506,0,0,0,0,0,0); //
AddPlayerClass(287,1588.4423,-1636.9617,13.4149,0.4094,0,0,0,0,0,0); // Admin
AddPlayerClass(288,1573.5120,-1635.6119,13.5481,42.6945,0,0,0,0,0,0); //

This is my skins


Re: Password to skin - Mencent - 30.03.2016

You can realize this. You have to put in the password MyPassword but you can change this.
PHP код:
//global
new PasswordClass[9];
//OnGameModeInit:
PasswordClass[0] = AddPlayerClass(280,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
PasswordClass[1] = AddPlayerClass(281,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
PasswordClass[2] = AddPlayerClass(282,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
PasswordClass[3] = AddPlayerClass(283,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
PasswordClass[4] = AddPlayerClass(284,1577.9375,-1627.9703,13.3828,88.5506,0,0,0,0,0,0); //
PasswordClass[5] = AddPlayerClass(285,1547.4600,-1640.0782,28.4021,89.8322,0,0,0,0,0,0); // SniperMan
PasswordClass[6] = AddPlayerClass(286,1572.1573,-1611.5800,13.3828,87.7506,0,0,0,0,0,0); //
PasswordClass[7] = AddPlayerClass(287,1588.4423,-1636.9617,13.4149,0.4094,0,0,0,0,0,0); // Admin
PasswordClass[8] = AddPlayerClass(288,1573.5120,-1635.6119,13.5481,42.6945,0,0,0,0,0,0); //
public OnPlayerRequestClass(playerid,classid)
{
    for(new 
i;i<sizeof(PasswordClass);i++)
    {
        if(
classid == PasswordClass[i])
        {
            
ShowPlayerDialog(playerid,DIALOG_SKINPW,DIALOG_STYLE_INPUT,"Password","Put in the password for the skin","Next","");
            break;
        }
    }
    return 
1;
}
if(
dialogid == DIALOG_SKINPW)
{
    if(
response)
    {
        if(!
strcmp(inputtext,"MyPassword",true))
        {
            
SpawnPlayer(playerid);
        }
    }
    return 
1;




Re: Password to skin - Bulgaria - 30.03.2016

Quote:

C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(67) : error 055: start of function body without function header
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(6 : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(70) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(73) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(76) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(79) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(81) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(83) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\The Walking Dead\gamemodes\TWD1.0.pwn(8 : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


9 Errors.

What now?


Re: Password to skin - Mencent - 30.03.2016

Where do you get the mistakes?


Re: Password to skin - Bulgaria - 30.03.2016

That is what i add
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1448.6843,-2286.8081,13.5469);
SetPlayerCameraPos(playerid, 1440.2529,-2286.7510,13.5469);
SetPlayerCameraLookAt(playerid, 1440.2529,-2286.7510,13.5469);
return 1;
}

{
for(new i;i<sizeof(PasswordClass);i++)
{
if(classid == PasswordClass[i])
{
ShowPlayerDialog(playerid,DIALOG_SKINPW,DIALOG_STY LE_INPUT,"Само членове на Армията знаят паролата! И имат право да използват тези скинове!");
break;
}
}
return 1;
}

if(dialogid == DIALOG_SKINPW)
{
if(response)
{
if(!strcmp(inputtext,"protectordie",true))
{
SpawnPlayer(playerid);
}
}
return 1;
}


Re: Password to skin - Mencent - 30.03.2016

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1448.6843,-2286.8081,13.5469);
    
SetPlayerCameraPos(playerid1440.2529,-2286.7510,13.5469);
    
SetPlayerCameraLookAt(playerid1440.2529,-2286.7510,13.5469);
    for(new 
i;i<sizeof(PasswordClass);i++)
    {
        if(
classid == PasswordClass[i])
        {
            
ShowPlayerDialog(playerid,DIALOG_SKINPW,DIALOG_STY LE_INPUT,"Само членове на Армията знаят паролата! И имат право да използват тези скинове!");
            break;
        }
    }
    return 
1;
}
//OnDialogResponse:
if(dialogid == DIALOG_SKINPW)
{
    if(
response)
    {
        if(!
strcmp(inputtext,"protectordie",true))
        {
            
SpawnPlayer(playerid);
        }
    }
    return 
1;




Re: Password to skin - Mencent - 31.03.2016

Only the skins who should have the password need the array PasswordClass[..] before the function AddPlayerClass. Not all skins!

Also you should write OnPlayerRequestClass like this:
PHP код:
public OnPlayerRequestClass(playerid,classid)
{
    for(new 
i;i<sizeof(PasswordClass);i++)
    {
        if(
classid == PasswordClass[i])
        {
            
ShowPlayerDialog(playerid,DIALOG_SKINPW,DIALOG_STYLE_INPUT,"Password","Put in the password for the skin","Next","");
            return 
1;
        }
    }
    
ShowPlayerDialog(playerid,-1,DIALOG_STYLE_INPUT," "," "," "," ");
    return 
1;

So when you choose a skin who needn't a password the dialog will hide.