How to make private vehicle with password and dialog?
#1

Well can someone help me ,how to make private vehicle with password and dialog?we fill the password in the dialog
Reply
#2

pawn Код:
new
    passwordedVeh,
    vehPassword[ 64 ] = "omgwtfbbq"
;

public OnGameModeInit( )
{
    passwordedVeh = AddStaticVehicle( 411, 0.0, 0.0, 0.0, 0.0, -1, -1 );

    return 1;
}

public OnPlayerEnterVehicle( playerid, vehicleid )
{
    if ( vehicleid == passwordedVeh )
    {
        ShowPlayerDialog( playerid, 777, DIALOG_STYLE_INPUT, "Error", "This vehicle is passworded, enter the password!", "Use Vehicle", "Exit" );

        TogglePlayerControllable( playerid, false );
    }

    return 1;
}

public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
    if ( dialogid == 777 )
    {
        if ( !strcmp( inputtext, vehPassword, false ) ) {
            TogglePlayerControllable( playerid, true );
            // success! u have entered the correct password
        }
        else {
            RemovePlayerFromVehicle( playerid );
            TogglePlayerControllable( playerid, true );
            // ERROR: u've entered a wrong password, kthxbai.
        }
    }

    return 1;
}
Something like that?
Reply
#3

Yeah thanks sir,but i got 1 error
Код:
D:\Test server\filterscripts\Valo_Car.pwn(238) : error 017: undefined symbol "vehpassword"
Reply
#4

It works fine like a charm for me, maybe there's a problem with your includes.

Offtopic: Iya ane Indonesia gan
Reply
#5

Eh sorry i make a mistake this is an error

Код:
D:\Test server\filterscripts\Valo_Car.pwn(238) : error 017: undefined symbol "vehpassword"
Reply
#6

vehpassword is CaSe SeNsItIvE

Change vehpassword

to

vehPassword
Reply
#7

Well that code is compile,but when i enter the password i'm freeze.we must change it to OnPlayerStateChange?
Reply
#8

pawn Код:
public OnStateChange( playerid, newstate, oldstate )
{
    if ( newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == passwordedVeh )
    {
        ShowPlayerDialog( playerid, 777, DIALOG_STYLE_INPUT, "Error", "This vehicle is passworded, enter the password!", "Use Vehicle", "Exit" );
        TogglePlayerControllable( playerid, false );
    }

    return 1;
}
Should work then.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)