Locking skins
#1

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
Reply
#2

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
Reply
#3

Код:
    {
    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
Reply
#4

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.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)