Locking skins - 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: Locking skins (
/showthread.php?tid=205333)
Locking skins -
Jack- - 01.01.2011
How do i make it so that if someone enters the wrong password it says Wrong Password
also what is wrong with this script
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
new locked[MAX_PLAYERS];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnGameModeInit()
{
AddPlayerClass(294, 0, 0, 0, 130, 24, 300, 0, 0, 0, 0); //Class 1 - Not passworded
AddPlayerClass(188, 0, 0, 0, 130, 24, 300, 0, 0, 0, 0); //Class 2 - Passworded
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0: Locked[playerid] = 1; //this one DOESNT.
case 1: Locked[playerid] = 1; //this one too
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(Locked[playerid]) return 0;
//If player's current class is passworded, stop them from spawning
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/unlock test "))
{
Locked[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Skins unlocked!");
}
return 1
Re: Locking skins -
Haydz - 01.01.2011
Check out this topic, it will teach you alot about varabiles and how to use them. Taught me how to use them when i first started.
https://sampforum.blast.hk/showthread.php?tid=189464
Re: Locking skins -
Stryke - 12.09.2011
Код:
{
case 0: Locked[playerid] = 1; //this one DOESNT.
case 1: Locked[playerid] = 1; //this one too
}
Its because they are set at 1, if you want to be able to use the skin without a password set them to 0
Re: Locking skins -
judothijs - 12.09.2011
I would really recommend you to use ZCMD and Scanff for this.
A quick example of the Command part:
pawn Код:
#include <zcmd>
#include <sscanf>
CMD:unlock(playerid, params[])
{
new password[35];
if(scanf(params, "s", password)) return SendClientMessage(playerid, 0x00FF0000, "wrong password!");
else
{
if(!strcmp(password, "YOUR_PASSWORD") == 0)
{
Locked[playerid] = 0;
}
{
else
{
Locked[playerid] = 1;
}
}
}
Hope this helps.
Re: Locking skins -
DRIFT_HUNTER - 12.09.2011
You set both classes to locked...
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0: Locked[playerid] = 1; //this one DOESNT.
case 1: Locked[playerid] = 1; //this one too
}
return 1;
}
update these
pawn Код:
case 0: Locked[playerid] = 0; //this one DOESNT.