How to password protect a skin -
JoeDaDude - 01.01.2010
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
Re: How to password protect a skin -
MJ! - 01.01.2010
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
Re: How to password protect a skin -
Mike Garber - 01.01.2010
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.
Re: How to password protect a skin -
JoeDaDude - 01.01.2010
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
Re: How to password protect a skin -
MJ! - 01.01.2010
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");
Re: How to password protect a skin -
JoeDaDude - 01.01.2010
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.
Re: How to password protect a skin -
_Vortex - 01.01.2010
Code:
public OnPlayerRequestSpawn(playerid)
{
if(classid == yourclass)
{
if(!IsPlayerAdmin(playerid)) {
return 0;
}
else {
return 1;
}
Re: How to password protect a skin -
MerLow - 01.01.2010
If you will check with a string:
pawn Code:
if(!strcmp(inputtext,"AbCdEfG",true))
Re: How to password protect a skin -
JoeDaDude - 01.01.2010
Thanks