How to make private vehicle with password and dialog?
#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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)