How to password protect a skin
#1

Hello,

Im making an admin skin, Everyone can see it,
But if they press shift when its selected,
It asks for a password, If the password is right, It spawns them with the skin as normal,
If its wrong, It dosent let them use it,
How would i do that properly? Ive tried several ways but havent succeeded
Reply
#2

At OnPlayerRequestClass

pawn Code:
if(classid == YOURSKIN)
{
   ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Skin","This skin requers a password !\nType down the correct password to choose it !,"OK","Cancel");
}
At OnDialogResponse

pawn Code:
if(response)
{
  switch(dialogid)
  {
     case 1:
     {
       if(strval(inputtext) == 99999)
       {
           SendClientMessage(playerid,COLOR_WHITE,"Correct Password. Skin taken.");
           SetPlayerSkin(playerid,YOURSKIN);
           TogglePlayerControllable(playerid,true);
           TogglePlayerSpectating(playerid,0);
           SetCameraBehindPlayer(playerid);
           SpawnPlayer(playerid);
        }
        else
        {
           SendClientMessage(playerid,COLOR_GREY,"Invalid Password !");
           return 1;
        }
     }
   }
}
99999 it's the password correct
Reply
#3

Quote:
Originally Posted by Щә яә Ґя
At OnPlayerRequestClass

pawn Code:
if(classid == YOURSKIN)
{
   ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Skin","This skin requers a password !\nType down the correct password to choose it !,"OK","Cancel");
}
At OnDialogResponse

pawn Code:
if(response)
{
  switch(dialogid)
  {
     case 1:
     {
       if(strval(inputtext) == 99999)
       {
           SendClientMessage(playerid,COLOR_WHITE,"Correct Password. Skin taken.");
           SetPlayerSkin(playerid,YOURSKIN);
           TogglePlayerControllable(playerid,true);
           TogglePlayerSpectating(playerid,0);
           SetCameraBehindPlayer(playerid);
           SpawnPlayer(playerid);
        }
        else
        {
           SendClientMessage(playerid,COLOR_GREY,"Invalid Password !");
           return 1;
        }
     }
   }
}
99999 it's the password correct
He would post in the Script Request thread If he wanted full codes.
You should just have explained how to do It, not give him the code.
Well, might not be a rule, but It'll help him to figure things out himself, and help him to become a scripter faster
rather then just a script kiddie who copy & paste everything.
Reply
#4

pawn Code:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Skin","This skin requers a password !\nType down the correct password to choose it !,"OK","Cancel");
    }
Code:
C:\Users\Torran\Documents\Server\gamemodes\CnR.pwn(264) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Torran\Documents\Server\gamemodes\CnR.pwn(264) : error 017: undefined symbol "OK"
C:\Users\Torran\Documents\Server\gamemodes\CnR.pwn(264) : warning 215: expression has no effect
C:\Users\Torran\Documents\Server\gamemodes\CnR.pwn(264) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Torran\Documents\Server\gamemodes\CnR.pwn(264) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.[/code
Reply
#5

err , i forgot to close the string ...

ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Sk in","This skin requers a password !\nType down the correct password to choose it !","OK","Cancel");
Reply
#6

Code:
Code:
pawn Code:
if(strval(inputtext) == AbCdEfG)
C:\Users\Torran\Documents\Server\gamemodes\CnR.pwn(863) : error 017: undefined symbol "AbCdEfG"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#7

Code:
public OnPlayerRequestSpawn(playerid)
{
if(classid == yourclass)
{
if(!IsPlayerAdmin(playerid)) {
return 0;
}
else {
return 1;
}
Reply
#8

If you will check with a string:

pawn Code:
if(!strcmp(inputtext,"AbCdEfG",true))
Reply
#9

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)